本帖最后由 merdly 于 2016-6-7 10:19 编辑
找到方法啦,提了问题就找到,之前一直找不到:
private void btnSearch_Click(object sender, EventArgs e)
{
string findText = awtSearch.Text;
if (findText != searchText)//搜索内容变化
{
searchIndex = 0;
searchItems = BedListBox.GetSubItemsByDisplayName(findText);//通过DisplayName获取SubItems
searchText = findText;
}
if (searchItems != null)
{
if (searchIndex < searchItems.Length)
{
BedListBox.SelectSubItem = searchItems[searchIndex];
}
searchIndex++;
if (searchIndex == searchItems.Length)
{
searchIndex = 0;
}
}
else//没有查找到
{
BedListBox.SelectSubItem = null;
}
}
但是有个问题,但是SubItem太多的话,选择的SubItem无法直接定位看到:
|
|