本文整理汇总了C#中System.Windows.Forms.ListView.SearchForVirtualItem事件的典型用法代码示例。如果您正苦于以下问题:C# ListView.SearchForVirtualItem事件的具体用法?C# ListView.SearchForVirtualItem怎么用?C# ListView.SearchForVirtualItem使用的例子?那么恭喜您, 这里精选的事件代码示例或许可以为您提供帮助。您也可以进一步了解该事件所在类System.Windows.Forms.ListView
的用法示例。
在下文中一共展示了ListView.SearchForVirtualItem事件的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: listView1_SearchForVirtualItem
//This event handler enables search functionality, and is called
//for every search request when in Virtual mode.
void listView1_SearchForVirtualItem(object sender, SearchForVirtualItemEventArgs e)
{
//We've gotten a search request.
//In this example, finding the item is easy since it's
//just the square of its index. We'll take the square root
//and round.
double x = 0;
if (Double.TryParse(e.Text, out x)) //check if this is a valid search
{
x = Math.Sqrt(x);
x = Math.Round(x);
e.Index = (int)x;
}
//If e.Index is not set, the search returns null.
//Note that this only handles simple searches over the entire
//list, ignoring any other settings. Handling Direction, StartIndex,
//and the other properties of SearchForVirtualItemEventArgs is up
//to this handler.
}