DataGridView的垂直滚动条无法正常更新(表格错误?)无法正常、滚动条、表格、错误

2023-09-04 02:42:07 作者:饿

我在.NET 3.5中遇到的错误(我认为)。当使用Rows.Add(),而DGV禁用添加行至一个DataGridView,垂直滚动条不正确地更新。因此,你可以使用滚动条或重新启用DGV后,鼠标滚轮一路不滚动到DGV的底部(箭头键仍然有效导航,虽然。)

I've encountered a bug (I assume) in .NET 3.5. When adding rows to a DataGridView using Rows.Add(), while the DGV is disabled, the vertical scrollbar doesn't update properly. Consequently you can't scroll all the way to the bottom of the DGV using the scrollbar or the mouse wheel after reenabling the DGV (navigating with arrow keys still works, though.)

所以我在寻找一种解决方法。有没有办法强制滚动条来更新它的边界,也可以手动输入一个新的最大值?我宁愿没有重新填充DGV。

So I'm looking for a workaround. Is there a way to force the scrollbar to update its bounds or can you manually input a new maximum value? I'd rather not have to repopulate the DGV.

*)其实,这是父窗体那是禁用的,但我认为问题是,它传播到DGV控制。

*) Actually, it's the parent form that's disabled, but I assume the problem is that it propagates to the DGV control.

推荐答案

我刚刚有这个问题(我的形式禁止同时添加行),并通过添加之前设置网格为无的滚动性解决它该行然后再将其设置为两个一旦我的所有行已被添加。

I've just had this problem (my form was disabled while adding rows) and solved it by setting the scrollbar property of the grid to 'None' before adding the rows then setting it back to 'Both' once all my rows have been added.