DrawListViewSubItemEventArgs.Item Własność
Definicja
Ważny
Niektóre informacje dotyczą produktów przedpremierowych, które mogą zostać znacznie zmodyfikowane przed premierą. Microsoft nie udziela żadnych gwarancji, ani wyraźnych, ani domniemanych, dotyczących informacji podanych tutaj.
Pobiera element nadrzędny ListViewItem elementu ListViewItem.ListViewSubItem do rysowania.
public:
property System::Windows::Forms::ListViewItem ^ Item { System::Windows::Forms::ListViewItem ^ get(); };
public System.Windows.Forms.ListViewItem Item { get; }
public System.Windows.Forms.ListViewItem? Item { get; }
member this.Item : System.Windows.Forms.ListViewItem
Public ReadOnly Property Item As ListViewItem
Wartość nieruchomości
Element ListViewItem reprezentujący element nadrzędny elementu ListViewItem.ListViewSubItem do rysowania.
Przykłady
Poniższy przykład kodu przedstawia użycie tego elementu członkowskiego. W tym przykładzie program obsługi zdarzeń zgłasza wystąpienie zdarzenia ListView.DrawSubItem . Ten raport pomaga dowiedzieć się, kiedy wystąpi zdarzenie i może pomóc w debugowaniu.
Aby uruchomić przykładowy kod, wklej go w projekcie zawierającym wystąpienie typu ListView o nazwie ListView1. Następnie upewnij się, że program obsługi zdarzeń jest skojarzony ze zdarzeniem ListView.DrawSubItem .
private void ListView1_DrawSubItem(Object sender, DrawListViewSubItemEventArgs 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}", "Item", e.Item );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "SubItem", e.SubItem );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ItemIndex", e.ItemIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ColumnIndex", e.ColumnIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Header", e.Header );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ItemState", e.ItemState );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "DrawSubItem Event" );
}
Private Sub ListView1_DrawSubItem(sender as Object, e as DrawListViewSubItemEventArgs) _
Handles ListView1.DrawSubItem
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}", "Item", e.Item)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "SubItem", e.SubItem)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "ItemIndex", e.ItemIndex)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "ColumnIndex", e.ColumnIndex)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Header", e.Header)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "ItemState", e.ItemState)
messageBoxVB.AppendLine()
MessageBox.Show(messageBoxVB.ToString(),"DrawSubItem Event")
End Sub
Uwagi
Użyj tej właściwości, aby uzyskać dostęp do ListViewItem elementu nadrzędnego ListViewItem.ListViewSubItem do rysowania. Jest to przydatne, gdy ItemState właściwość nie dostarcza odpowiednich informacji w celu spełnienia Twoich potrzeb. Właściwość ItemState udostępnia tylko podstawowe informacje o stanie, których można użyć, na przykład w celu określenia, czy element nadrzędny jest zaznaczony, zaznaczony, czy skoncentrowany. Z Item drugiej strony właściwość umożliwia dostęp do wszystkich elementów członkowskich elementu nadrzędnego ListViewItem.
Aby uzyskać dostęp do rysunku ListViewItem.ListViewSubItem , użyj SubItem właściwości .