SearchForVirtualItemEventArgs SearchForVirtualItemEventArgs SearchForVirtualItemEventArgs SearchForVirtualItemEventArgs Class

定义

SearchForVirtualItem 事件提供数据。Provides data for the SearchForVirtualItem event.

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

示例

下面的代码示例演示如何使用此类型。The following code example demonstrates the use of this type. 在此示例中, 事件处理程序报告SearchForVirtualItem事件的发生。In the example, an event handler reports on the occurrence of the SearchForVirtualItem event. 此报表可帮助你了解何时发生事件, 并可帮助你进行调试。This report helps you to learn when the event occurs and can assist you in debugging. 若要报告多个事件或频繁发生的事件, 请考虑ShowConsole.WriteLine消息替换为多行或将TextBox其追加到多行。To report on multiple events or on events that occur frequently, consider replacing Show with Console.WriteLine or appending the message to a multiline TextBox.

若要运行示例代码, 请将其粘贴到包含名为ListView ListView1的类型的实例的项目中。To run the example code, paste it into a project that contains an instance of type ListView named ListView1. 然后, 确保事件处理程序与SearchForVirtualItem事件相关联。Then ensure that the event handler is associated with the SearchForVirtualItem event.

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

注解

FindNearestItem SearchForVirtualItem FindItemWithText ListView在虚拟模式下, 在控件上调用或方法时构造并传递给事件。 SearchForVirtualItemEventArgsThe SearchForVirtualItemEventArgs is constructed and passed to the SearchForVirtualItem event when you call the FindItemWithText or FindNearestItem methods on a ListView control in virtual mode.

构造函数

SearchForVirtualItemEventArgs(Boolean, Boolean, Boolean, String, Point, SearchDirectionHint, Int32) SearchForVirtualItemEventArgs(Boolean, Boolean, Boolean, String, Point, SearchDirectionHint, Int32) SearchForVirtualItemEventArgs(Boolean, Boolean, Boolean, String, Point, SearchDirectionHint, Int32) SearchForVirtualItemEventArgs(Boolean, Boolean, Boolean, String, Point, SearchDirectionHint, Int32)

初始化 SearchForVirtualItemEventArgs 类的新实例。Initializes a new instance of the SearchForVirtualItemEventArgs class.

属性

Direction Direction Direction Direction

获取自当前项应执行搜索的方向。Gets the direction from the current item that the search should take place.

IncludeSubItemsInSearch IncludeSubItemsInSearch IncludeSubItemsInSearch IncludeSubItemsInSearch

获取一个值,该值指示搜索是否应包括列表项的子项。Gets a value indicating whether the search should include subitems of list items.

Index Index Index Index

获取或设置 ListViewItem 中找到的 ListView 的索引。Gets or sets the index of the ListViewItem found in the ListView .

IsPrefixSearch IsPrefixSearch IsPrefixSearch IsPrefixSearch

获取一个值,该值指示搜索是否应返回项文本以搜索文本开头的项。Gets a value indicating whether the search should return an item if its text starts with the search text.

IsTextSearch IsTextSearch IsTextSearch IsTextSearch

获取一个值,该值指示搜索是否为文本搜索。Gets a value indicating whether the search is a text search.

StartIndex StartIndex StartIndex StartIndex

获取搜索起始处的 ListViewItem 的索引。Gets the index of the ListViewItem where the search starts.

StartingPoint StartingPoint StartingPoint StartingPoint

获取搜索的起始位置。Gets the starting location of the search.

Text Text Text Text

获取用于在 ListView 控件中查找项的文本。Gets the text used to find an item in the ListView control.

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

适用于