有没有办法找出单个选择windows.forms.listbox的可视区域中的项目 [英] Is there a way to find out what item is in the viewable area of a single selection windows.forms.listbox
问题描述
我的表单上有一个Windows.Forms.ListBox,它的SelectionMod为1。我试图找出用户在列表框中向上或向下滚动的时间,但是如果我可以捕获该可见值,则不会选择可见的条目。有没有办法做到这一点。谢谢。
我尝试了什么:
我试过了创建一个Control.ListBoxItem,设置它的Content的值,然后将其添加到ListBox中的Items。 ListBoxItems有一个我希望使用的isVisible属性,但是没有用。
I have a Windows.Forms.ListBox on my form, it has a SelectionMod of one. I'm trying to find out when a user scrolls up or down on the listbox, but doesn't select the entry that's visible, if I can capture that visible value or not. is there a way to do this. Thanks.
What I have tried:
I've tried creating a Control.ListBoxItem, setting a value of it's Content, and then adding that to the Items in the ListBox. The ListBoxItems have an isVisible property that I was hoping to use, but that didn't work.
推荐答案
你想要的属性是 TopIndex
。请参阅 ListBox类(System.Windows.Forms) [ ^ ]
The property you want is TopIndex
. See ListBox Class (System.Windows.Forms)[^]
这篇关于有没有办法找出单个选择windows.forms.listbox的可视区域中的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!