问题描述
您好,我的表单中有一个listview(带有 Scrollable = true
),我正在使用循环填充它。在循环中,我调用 Application.DoEvents()
,然后添加当前项( listview.add(...)
),到目前为止一直很好。
如果以后我尝试添加更多项目而不点击/按任何列表视图正常行为,但如果我滚动使用鼠标滚轮,当它仍然添加项目时,listview会在每次添加项目时自动滚动到顶部。
长话短说:如何我可以在添加项目时将其停止自动滚动到顶部吗?
注意:如果我使用滚动条,这不会发生,箭头键或向上/向下翻页,同时它仍然只用鼠标滚轮添加项目。
Hello, I have a listview(with Scrollable = true
) in my form and I''m populating it using a loop. In the loop I call Application.DoEvents()
and then I add the current item( listview.add(...)
), so far so good.
If later I try to add some more items without clicking/pressing anything the listview behaves normally, but if I scroll using the mouse wheel while it''s still adding the items the listview auto-scrolls to the top each time an item is added.
Long story short: How can I stop it from auto-scrolling to the top when an item is added?
Note: this doesn''t happen if I use the scrollbar, the arrow keys or page up/down while it''s still adding items only with the mouse wheel.
推荐答案
这篇关于Listview自动滚动到顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!