DataGridView vertical scrollbar not updating properly (Forms bug?)

后端 未结 14 1957
伪装坚强ぢ
伪装坚强ぢ 2021-01-03 23:49

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 proper

14条回答
  •  臣服心动
    2021-01-04 00:01

    Actually, I just found one workaround but I don't like it. After the DGV is reenabled you can do this:

    int x = Rows.Add();
    Rows.RemoveAt(x);
    

    And then the scrollbar is updated. But it's not very pretty, it causes an annoying little flicker, and it might fire some events which I'd have to deliberately ignore. I'll leave the question open for a bit in the hope of a better solution.

提交回复
热议问题