Set max height for text box

Sometimes after a resize, the text box becomes way too heigh.
This commit is contained in:
Nikolaj Olsson 2020-11-15 18:17:34 +01:00
parent c261b30bc0
commit fca88ffbde
2 changed files with 257 additions and 226 deletions

File diff suppressed because it is too large Load Diff

View File

@ -20620,6 +20620,9 @@ namespace Nikse.SubtitleEdit.Forms
private void Main_Shown(object sender, EventArgs e)
{
splitContainerListViewAndText.SplitterMoved += splitContainerListViewAndText_SplitterMoved;
splitContainerListViewAndText.SizeChanged += splitContainerListViewAndText_SizeChanged;
imageListBookmarks.Images.Add(pictureBoxBookmark.Image);
SetListViewStateImages();
@ -28762,5 +28765,24 @@ namespace Nikse.SubtitleEdit.Forms
aSSStylesToolStripMenuItem.Visible = false;
}
}
private void splitContainerListViewAndText_SplitterMoved(object sender, SplitterEventArgs e)
{
if (Configuration.Settings.General.SubtitleTextBoxMaxHeight < splitContainerListViewAndText.Panel2MinSize &&
Configuration.Settings.General.SubtitleTextBoxMaxHeight > 1000)
{
return;
}
if (splitContainerListViewAndText.Panel2.Height > Configuration.Settings.General.SubtitleTextBoxMaxHeight)
{
splitContainerListViewAndText.SplitterDistance = splitContainerListViewAndText.Height - Configuration.Settings.General.SubtitleTextBoxMaxHeight;
}
}
private void splitContainerListViewAndText_SizeChanged(object sender, EventArgs e)
{
splitContainerListViewAndText_SplitterMoved(null, null);
}
}
}