问题描述
当递交 DataGridView.Scroll
事件时,您可以检查是否是滚动的结尾(当用鼠标拖动滚动条时,这可能是当鼠标按钮被释放)
问题在于,这似乎并不会发生。 e.Type
永远不会 ScrollEventType.EndScroll
什么是错了这个?只有当滚动完成时,我该怎么办?
private void dataGridView_Scroll(object sender,ScrollEventArgs e)
/ pre>
{
if(e.Type == ScrollEventType.EndScroll)
{
// ...
}
}
解决方案嗯,似乎这个事件只是被发现。
您可以锁定DGV的私有滚动条对象(通过反射)并处理其事件,其中
ScrollEventType.EndScroll
按预期出现。
看到这个链接如何做。
When handing the
DataGridView.Scroll
event, you can check whether it was the end of the scroll (when dragging the scroll bar with the mouse, this is presumably when the mouse button is released).The problem is that this never seems to happen.
e.Type
is neverScrollEventType.EndScroll
What's wrong with this? How can I do something only when scrolling finishes?
private void dataGridView_Scroll(object sender, ScrollEventArgs e) { if (e.Type == ScrollEventType.EndScroll) { // ... } }
解决方案Well, it seems that this event is just bugged.
You can latch on the the DGV's private scroll bar objects (via reflection) and handle their events, where
ScrollEventType.EndScroll
appears as expected.See this this link for how to do it.
这篇关于DataGridView Scroll事件(和ScrollEventType.EndScroll)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!