.NET FrameWork>参考>类库>System.Windows.Forms>ListBox类的属性
1. 属性列表:
SelectionMode
组件中条目的选择类型:
None-根本不允许任何选择;One-默认值,只选择单个选项;MultiSimple-简单的多项选择,单击一次鼠标就选中或取消选中列表中的一项;MultiExtended-扩展的多项选择,类似windows中的选择操作.
SelectedItem
在单选的列表框里, SelectedItem
返回的是一个对象,它的文本由Text属性表示.作用是
获得列表框中被选择的条目.如果控件允许多项选择,被选中的条目就以SelectedItems属性表示,它是Item对象的一个集合.
Count
Count
列表框中条目的总数
SelectedIndex /SelectedIndices/SelectedItem/SelectedItems
SelectedIndex /SelectedIndices/SelectedItem/SelectedItems
ListBox.SelectedIndex属性获取单项选择ListBox中当前选定项的位置;ListBox.SelectedIndices属性获取一个集合,该集合包含ListBox中所有当前选定项的从零开始的索引;ListBox.SelectedItem属性获取ListBox中当前选定的项;ListBox.SelectedItems属性获取多重选择ListBox中所有选定的项,它是一集合。
Public ReadOnly Property SelectedIndices As ListBox.SelectedIndexCollection
ListBox.SelectedIndexCollection,包含控件中当前选定项的索引。如果当前没有选定的项,则返回空 ListBox.SelectedIndexCollection
泛指列表框中的所有项
2. 取列表框中被选中的值
ListBox.SelectedValue
3.

这篇博客详细介绍了如何在.NET Framework中使用System.Windows.Forms.ListBox类,包括选择模式设置、获取选中值、动态添加与删除项、多选功能、搜索字符串、防止重复添加、联动效果以及项的移位等操作。
最低0.47元/天 解锁文章
2万+

被折叠的 条评论
为什么被折叠?



