* UIDataGridView: 修复了有冻结行时垂直滚动条点击时出错的问题

This commit is contained in:
Sunny 2023-07-12 10:01:33 +08:00
parent ec60c9af19
commit 2798c6d59a

View File

@ -45,6 +45,7 @@
* 2022-07-28: V3.2.2
* 2022-10-14: V3.2.6
* 2023-06-28: V3.3.9 使
* 2023-07-12: V3.4.0
******************************************************************************/
using System;
@ -369,6 +370,23 @@ namespace Sunny.UI
if (idx < 0) idx = 0;
if (idx >= RowCount) idx = RowCount - 1;
int lastFrozen = GetFrozenBottomIndex();
if (Rows[0].Frozen)
{
if (RowCount > lastFrozen + 1)
{
lastFrozen += 1;
FirstDisplayedScrollingRowIndex = Math.Max(idx, lastFrozen);
}
}
else
{
FirstDisplayedScrollingRowIndex = idx;
}
}
private int GetFrozenBottomIndex()
{
int lastFrozen = 0;
if (Rows[0].Frozen)
{
@ -385,12 +403,7 @@ namespace Sunny.UI
}
}
if (Rows[0].Frozen)
{
}
FirstDisplayedScrollingRowIndex = Math.Max(idx, lastFrozen);
return lastFrozen;
}
private void HorizontalScrollBar_ValueChanged(object sender, EventArgs e)
@ -753,7 +766,20 @@ namespace Sunny.UI
}
Rows[value].Selected = true;
int lastFrozen = GetFrozenBottomIndex();
if (Rows[0].Frozen)
{
if (RowCount > lastFrozen + 1)
{
lastFrozen += 1;
FirstDisplayedScrollingRowIndex = Math.Max(value, lastFrozen);
}
}
else
{
FirstDisplayedScrollingRowIndex = value;
}
if (selectedIndex >= 0 && selectedIndex <= Rows.Count)
jumpIndex = selectedIndex;