SearchForVirtualItemEventArgs.Direction Свойство

Определение

Получает направление из текущего элемента, в котором должен выполняться поиск.

public:
 property System::Windows::Forms::SearchDirectionHint Direction { System::Windows::Forms::SearchDirectionHint get(); };
public System.Windows.Forms.SearchDirectionHint Direction { get; }
member this.Direction : System.Windows.Forms.SearchDirectionHint
Public ReadOnly Property Direction As SearchDirectionHint

Значение свойства

Одно из значений перечисления SearchDirectionHint.

Примеры

В следующем примере кода показано использование этого элемента. В этом примере обработчик событий сообщает о возникновении ListView.SearchForVirtualItem события. Этот отчет поможет вам узнать, когда происходит событие, и поможет вам в отладке. Чтобы сообщить о нескольких событиях или о событиях, которые происходят часто, рекомендуется заменить MessageBox.ShowConsole.WriteLine сообщение или добавить его в многостроочный TextBox.

Чтобы выполнить пример кода, вставьте его в проект, содержащий экземпляр типа ListView с именем ListView1. Затем убедитесь, что обработчик событий связан с событием ListView.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

Комментарии

Определение ближайшего элемента в элементе ListView управления может отличаться в зависимости от операционной системы, в котором выполняется приложение, поэтому направление поиска является подсказкой, а не абсолютной гарантией результатов.

Применяется к