DrawListViewSubItemEventArgs.Item プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
描画するListViewItem.ListViewSubItemの親ListViewItemを取得します。
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
プロパティ値
描画するListViewItem.ListViewSubItemの親を表すListViewItem。
例
次のコード例は、このメンバーの使用方法を示しています。 この例では、イベント ハンドラーは、 ListView.DrawSubItem イベントの発生を報告します。 このレポートは、イベントがいつ発生するかを学習するのに役立ち、デバッグに役立ちます。
コード例を実行するには、ListViewという名前の型のインスタンスを含むプロジェクトListView1貼り付けます。 次に、イベント ハンドラーが 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
注釈
描画するListViewItem.ListViewSubItemのListViewItem親にアクセスするには、このプロパティを使用します。 これは、 ItemState プロパティがニーズを満たすのに十分な情報を提供しない場合に便利です。 ItemState プロパティは、親項目が選択、チェック、またはフォーカスされているかどうかを判断するために使用できる基本的な状態情報のみを提供します。 一方、 Item プロパティを使用すると、親 ListViewItemのすべてのメンバーにアクセスできます。
描画されている ListViewItem.ListViewSubItem にアクセスするには、 SubItem プロパティを使用します。