DataGridView.CellContentDoubleClick イベント

定義

ユーザーがセルの内容をダブルクリックしたときに発生します。

public:
 event System::Windows::Forms::DataGridViewCellEventHandler ^ CellContentDoubleClick;
public event System.Windows.Forms.DataGridViewCellEventHandler CellContentDoubleClick;
member this.CellContentDoubleClick : System.Windows.Forms.DataGridViewCellEventHandler 
Public Custom Event CellContentDoubleClick As DataGridViewCellEventHandler 

イベントの種類

次のコード例は、このメンバーの使用方法を示しています。 この例では、イベント ハンドラーは、 CellContentDoubleClick イベントの発生を報告します。 このレポートは、イベントがいつ発生するかを学習するのに役立ち、デバッグに役立ちます。 複数のイベントや頻繁に発生するイベントについて報告するには、 MessageBox.ShowConsole.WriteLine に置き換えるか、メッセージを複数行の TextBoxに追加することを検討してください。

コード例を実行するには、DataGridViewという名前の型のインスタンスを含むプロジェクトDataGridView1貼り付けます。 次に、イベント ハンドラーが CellContentDoubleClick イベントに関連付けられていることを確認します。

private void DataGridView1_CellContentDoubleClick(Object sender, DataGridViewCellEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "ColumnIndex", e.ColumnIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "CellContentDoubleClick Event" );
}
Private Sub DataGridView1_CellContentDoubleClick(sender as Object, e as DataGridViewCellEventArgs) _ 
     Handles DataGridView1.CellContentDoubleClick

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "ColumnIndex", e.ColumnIndex)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"CellContentDoubleClick Event")

End Sub

注釈

イベントの処理方法の詳細については、「イベントの 処理と発生」を参照してください。

適用対象

こちらもご覧ください