[BUG] ArgumentOutOfRangeException since version 1.2.3.6 (#322), version 1.2.6.1

This commit is contained in:
Markus Hofknecht 2022-02-07 19:22:16 +01:00
parent 021d1b2d85
commit 37355bdfe1
2 changed files with 12 additions and 4 deletions

View file

@ -1096,7 +1096,7 @@ namespace SystemTrayMenu.Business
{
RowData rowData = (RowData)dgv.Rows[hitTestInfo.RowIndex].Cells[2].Value;
rowData.MouseDown(dgv, e);
dgv.InvalidateRow(hitTestInfo.RowIndex);
InvalidateRowIfIndexInRange(dgv, hitTestInfo.RowIndex);
}
if (e.Button == MouseButtons.Left)
@ -1181,7 +1181,7 @@ namespace SystemTrayMenu.Business
{
RowData trigger = (RowData)dgv.Rows[hitTestInfo.RowIndex].Cells[2].Value;
trigger.DoubleClick(e, out bool toCloseByDoubleClick);
dgv.InvalidateRow(hitTestInfo.RowIndex);
InvalidateRowIfIndexInRange(dgv, hitTestInfo.RowIndex);
if (toCloseByDoubleClick)
{
MenusFadeOut();
@ -1191,6 +1191,14 @@ namespace SystemTrayMenu.Business
lastMouseDownRowIndex = -1;
}
private void InvalidateRowIfIndexInRange(DataGridView dgv, int rowIndex)
{
if (rowIndex > -1 && rowIndex < dgv.Rows.Count)
{
dgv.InvalidateRow(rowIndex);
}
}
private void Dgv_SelectionChanged(object sender, EventArgs e)
{
RefreshSelection((DataGridView)sender);

View file

@ -39,5 +39,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.6.0")]
[assembly: AssemblyFileVersion("1.2.6.0")]
[assembly: AssemblyVersion("1.2.6.1")]
[assembly: AssemblyFileVersion("1.2.6.1")]