SearchForVirtualItemEventArgs 类

定义

提供事件的数据 SearchForVirtualItem

public ref class SearchForVirtualItemEventArgs : EventArgs
public class SearchForVirtualItemEventArgs : EventArgs
type SearchForVirtualItemEventArgs = class
    inherit EventArgs
Public Class SearchForVirtualItemEventArgs
Inherits EventArgs
继承
SearchForVirtualItemEventArgs

示例

下面的代码示例演示了此类型的用法。 在此示例中,事件处理程序报告事件的发生情况 SearchForVirtualItem 。 此报告可帮助你了解事件发生的时间,并可以帮助你进行调试。 若要报告多个事件或频繁发生的事件,请考虑替换ShowConsole.WriteLine或将消息追加到多行TextBox

若要运行示例代码,请将其粘贴到包含命名ListView类型的ListView1实例的项目中。 然后,确保事件处理程序与 SearchForVirtualItem 事件相关联。

private void ListView1_SearchForVirtualItem(Object sender, SearchForVirtualItemEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "IsTextSearch", e.IsTextSearch );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "IncludeSubItemsInSearch", e.IncludeSubItemsInSearch );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Index", e.Index );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "IsPrefixSearch", e.IsPrefixSearch );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Text", e.Text );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "StartingPoint", e.StartingPoint );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Direction", e.Direction );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "StartIndex", e.StartIndex );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "SearchForVirtualItem Event" );
}
Private Sub ListView1_SearchForVirtualItem(sender as Object, e as SearchForVirtualItemEventArgs) _ 
     Handles ListView1.SearchForVirtualItem

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "IsTextSearch", e.IsTextSearch)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "IncludeSubItemsInSearch", e.IncludeSubItemsInSearch)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Index", e.Index)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "IsPrefixSearch", e.IsPrefixSearch)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Text", e.Text)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "StartingPoint", e.StartingPoint)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Direction", e.Direction)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "StartIndex", e.StartIndex)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"SearchForVirtualItem Event")

End Sub

注解

SearchForVirtualItemEventArgs在虚拟模式下对控件调用SearchForVirtualItemFindItemWithText方法FindNearestItem时,将构造并传递给ListView事件。

构造函数

名称 说明
SearchForVirtualItemEventArgs(Boolean, Boolean, Boolean, String, Point, SearchDirectionHint, Int32)

初始化 SearchForVirtualItemEventArgs 类的新实例。

属性

名称 说明
Direction

从当前项获取搜索应发生的方向。

IncludeSubItemsInSearch

获取一个值,该值指示搜索是否应包含列表项的子项。

Index

获取或设置在 . 中ListViewItem找到的ListView索引。

IsPrefixSearch

获取一个值,该值指示搜索是否应在搜索文本以搜索文本开头时返回项。

IsTextSearch

获取一个值,该值指示搜索是否为文本搜索。

StartIndex

获取搜索开始位置的 ListViewItem 索引。

StartingPoint

获取搜索的起始位置。

Text

获取用于在控件中 ListView 查找项的文本。

方法

名称 说明
Equals(Object)

确定指定的对象是否等于当前对象。

(继承自 Object)
GetHashCode()

用作默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object的浅表副本。

(继承自 Object)
ToString()

返回一个表示当前对象的字符串。

(继承自 Object)

适用于