* UIDataGridView: 修复了ScrollBars为None时仍然显示滚动条的问题

* UIDataGridView: 修复了单行时表格高度低时,垂直滚动条拖拽至底部出错的问题
This commit is contained in:
Sunny 2022-07-29 10:21:21 +08:00
parent dc8b8a00a3
commit 55fe87d8f3

View File

@ -41,6 +41,8 @@
* 2022-06-22: V3.2.0 ShowRectShowGridLineRowHeight三个属性 * 2022-06-22: V3.2.0 ShowRectShowGridLineRowHeight三个属性
* 2022-07-11: V3.2.1 * 2022-07-11: V3.2.1
* 2022-07-11: V3.2.1 线 * 2022-07-11: V3.2.1 线
* 2022-07-28: V3.2.2 ScrollBars为None时仍然显示滚动条的问题
* 2022-07-28: V3.2.2
******************************************************************************/ ******************************************************************************/
using System; using System;
@ -286,7 +288,11 @@ namespace Sunny.UI
private void VBarValueChanged(object sender, EventArgs e) private void VBarValueChanged(object sender, EventArgs e)
{ {
FirstDisplayedScrollingRowIndex = VBar.Value; if (RowCount == 0) return;
int idx = VBar.Value;
if (idx < 0) idx = 0;
if (idx >= RowCount) idx = RowCount - 1;
FirstDisplayedScrollingRowIndex = idx;
} }
private void HorizontalScrollBar_ValueChanged(object sender, EventArgs e) private void HorizontalScrollBar_ValueChanged(object sender, EventArgs e)
@ -316,7 +322,7 @@ namespace Sunny.UI
{ {
VBar.Maximum = RowCount - DisplayedRowCount(false); VBar.Maximum = RowCount - DisplayedRowCount(false);
VBar.Value = FirstDisplayedScrollingRowIndex; VBar.Value = FirstDisplayedScrollingRowIndex;
VBar.Visible = true; VBar.Visible = ScrollBars == ScrollBars.Vertical || ScrollBars == ScrollBars.Both;
} }
else else
{ {
@ -329,7 +335,7 @@ namespace Sunny.UI
HBar.Value = HorizontalScrollBar.Value; HBar.Value = HorizontalScrollBar.Value;
HBar.BoundsWidth = HorizontalScrollBar.LargeChange; HBar.BoundsWidth = HorizontalScrollBar.LargeChange;
HBar.LargeChange = HorizontalScrollBar.LargeChange;//.Maximum / VisibleColumnCount(); HBar.LargeChange = HorizontalScrollBar.LargeChange;//.Maximum / VisibleColumnCount();
HBar.Visible = true; HBar.Visible = ScrollBars == ScrollBars.Horizontal || ScrollBars == ScrollBars.Both;
} }
else else
{ {