DrawListViewColumnHeaderEventArgs.State Свойство

Определение

Получает текущее состояние заголовка столбца.

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

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

Побитовая комбинация значений ListViewItemStates, указывающая текущее состояние заголовка столбца.

Примеры

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

Чтобы выполнить пример кода, вставьте его в проект, содержащий экземпляр типа ListView с именем ListView1. Затем убедитесь, что обработчик событий связан с событием ListView.DrawColumnHeader .

private void ListView1_DrawColumnHeader(Object sender, DrawListViewColumnHeaderEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "DrawDefault", e.DrawDefault );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Graphics", e.Graphics );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Bounds", e.Bounds );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ColumnIndex", e.ColumnIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Header", e.Header );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "State", e.State );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ForeColor", e.ForeColor );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "BackColor", e.BackColor );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Font", e.Font );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "DrawColumnHeader Event" );
}
Private Sub ListView1_DrawColumnHeader(sender as Object, e as DrawListViewColumnHeaderEventArgs) _ 
     Handles ListView1.DrawColumnHeader

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "DrawDefault", e.DrawDefault)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Graphics", e.Graphics)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Bounds", e.Bounds)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "ColumnIndex", e.ColumnIndex)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Header", e.Header)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "State", e.State)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "ForeColor", e.ForeColor)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "BackColor", e.BackColor)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Font", e.Font)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"DrawColumnHeader Event")

End Sub

Комментарии

Используйте это свойство, чтобы определить, находится ли указатель мыши на заголовке или пользователь щелкнул заголовок. Для ListViewItemStates этих состояний используются Hot значения и Selected.

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

См. также раздел