DataGridViewCellEventArgs クラスとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataGridViewCellEventArgs クラスの意味・解説 

DataGridViewCellEventArgs クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

セルと行の操作関連する DataGridView イベント向けのデータ提供します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Class DataGridViewCellEventArgs
    Inherits EventArgs
Dim instance As DataGridViewCellEventArgs
public class DataGridViewCellEventArgs : EventArgs
public ref class DataGridViewCellEventArgs
 : public EventArgs
public class DataGridViewCellEventArgs extends
 EventArgs
public class DataGridViewCellEventArgs extends
 EventArgs
解説解説

DataGridViewCellEventArgs クラスでは、次の DataGridView イベント向けのデータ提供されます。

  • CellClick

  • CellContentClick

  • CellContextMenuStripChanged

  • CellEndEdit

  • CellEnter

  • CellErrorTextChanged

  • CellLeave

  • CellMouseEnter

  • CellMouseLeave

  • CellStyleChanged

  • CellToolTipTextChanged

  • CellValidated

  • CellValueChanged

  • RowEnter

  • RowLeave

  • RowValidated

使用例使用例

CellMouseEnter イベント ハンドラCellMouseLeave イベント ハンドラ使用してセルクリックできるかどうか確認するコード例次に示します。この例で ToolTipText プロパティの各値を更新して現在のイメージレイアウトアドバタイズます。ここに示すコードは、「方法 : Windows フォーム DataGridView コントロールイメージ列を操作する」に示すコード一部です。

Private Sub dataGridView1_CellMouseEnter(ByVal
 sender As Object, _
    ByVal e As DataGridViewCellEventArgs) _
    Handles dataGridView1.CellMouseEnter

    Dim markingUnderMouse As Bitmap = _
        CType(dataGridView1.Rows(e.RowIndex). _
            Cells(e.ColumnIndex).Value, Bitmap)

    If markingUnderMouse Is blank Then
        dataGridView1.Cursor = Cursors.Default
    ElseIf markingUnderMouse Is o OrElse
 markingUnderMouse Is x Then
        dataGridView1.Cursor = Cursors.No
        ToolTip(e)
    End If
End Sub

Private Sub ToolTip( _
    ByVal e As DataGridViewCellEventArgs)

    Dim cell As DataGridViewImageCell = _
        CType(dataGridView1.Rows(e.RowIndex). _
        Cells(e.ColumnIndex), DataGridViewImageCell)
    Dim imageColumn As DataGridViewImageColumn
 = _
        CType(dataGridView1.Columns(cell.ColumnIndex), _
        DataGridViewImageColumn)

    cell.ToolTipText = imageColumn.Description
End Sub

Private Sub dataGridView1_CellMouseLeave(ByVal
 sender As Object, _
    ByVal e As DataGridViewCellEventArgs) _
    Handles dataGridView1.CellMouseLeave

    dataGridView1.Cursor = Cursors.Default
End Sub
private void dataGridView1_CellMouseEnter(object
 sender,
    DataGridViewCellEventArgs e)
{
    Bitmap markingUnderMouse = (Bitmap)dataGridView1.
           Rows[e.RowIndex].
           Cells[e.ColumnIndex].Value;

    if (markingUnderMouse == blank)
    {
        dataGridView1.Cursor = Cursors.Default;
    }
    else if (markingUnderMouse == o || markingUnderMouse
 == x)
    {
        dataGridView1.Cursor = Cursors.No;
        ToolTip(e, true);
    }
}

private void ToolTip(DataGridViewCellEventArgs
 e, bool showTip)
{
    DataGridViewImageCell cell = (DataGridViewImageCell)
        dataGridView1
        .Rows[e.RowIndex].Cells[e.ColumnIndex];
    DataGridViewImageColumn imageColumn =
        (DataGridViewImageColumn)
        dataGridView1.Columns[cell.ColumnIndex];

    if (showTip) cell.ToolTipText = imageColumn.Description;
    else { cell.ToolTipText = String.Empty; }
}

private void dataGridView1_CellMouseLeave(object
 sender,
    DataGridViewCellEventArgs e)
{
    ToolTip(e, false);
    dataGridView1.Cursor = Cursors.Default;
}
継承階層継承階層
System.Object
   System.EventArgs
    System.Windows.Forms.DataGridViewCellEventArgs
       System.Windows.Forms.DataGridViewCellContextMenuStripNeededEventArgs
       System.Windows.Forms.DataGridViewCellErrorTextNeededEventArgs
       System.Windows.Forms.DataGridViewCellToolTipTextNeededEventArgs
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridViewCellEventArgs メンバ
System.Windows.Forms 名前空間
DataGridView クラス
DataGridViewCellEventHandler



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DataGridViewCellEventArgs クラス」の関連用語

DataGridViewCellEventArgs クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DataGridViewCellEventArgs クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS