Allow resizing 'Text' Column instead 'Gap to next in seconds'

This commit is contained in:
ivandroly 2015-07-24 17:11:25 +00:00 committed by ivandrofly
parent 3e2c5f4136
commit cd966162db
2 changed files with 24 additions and 0 deletions

View File

@ -1108,5 +1108,12 @@ namespace Nikse.SubtitleEdit.Controls
}
}
public void SetCustomResize(EventHandler handler)
{
if (handler == null)
return;
Resize -= SubtitleListViewResize;
Resize += handler;
}
}
}

View File

@ -19,6 +19,9 @@ namespace Nikse.SubtitleEdit.Forms
InitializeComponent();
Utilities.FixLargeFonts(this, buttonOK);
// Remove SE's built-in ListView resize logic
SubtitleListview1.SetCustomResize(SubtitleListView1_Resize);
Text = Configuration.Settings.Language.DurationsBridgeGaps.Title;
buttonOK.Text = Configuration.Settings.Language.General.Ok;
buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
@ -193,5 +196,19 @@ namespace Nikse.SubtitleEdit.Forms
GeneratePreview();
}
private void SubtitleListView1_Resize(object sender, EventArgs e)
{
// Store last column with 'cause it won't be changed
var columnsCount = SubtitleListview1.Columns.Count - 1;
var lastColumnWidth = SubtitleListview1.Columns[columnsCount].Width;
var width = 0;
for (int i = 0; i < 3; i++)
{
width += SubtitleListview1.Columns[i].Width;
}
SubtitleListview1.Columns[4].Width = SubtitleListview1.Width - (width + lastColumnWidth);
SubtitleListview1.Columns[columnsCount].Width = lastColumnWidth;
}
}
}