DataGridView.HitTest メソッドとは? わかりやすく解説

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

DataGridView.HitTest メソッド

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

インデックス、列インデックスなど、x 座標y 座標指定して位置情報返します

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

Public Function HitTest ( _
    x As Integer, _
    y As Integer _
) As HitTestInfo
Dim instance As DataGridView
Dim x As Integer
Dim y As Integer
Dim returnValue As HitTestInfo

returnValue = instance.HitTest(x, y)
public HitTestInfo HitTest (
    int x,
    int y
)
public:
HitTestInfo^ HitTest (
    int x, 
    int y
)
public HitTestInfo HitTest (
    int x, 
    int y
)
public function HitTest (
    x : int, 
    y : int
) : HitTestInfo

パラメータ

x

x 座標

y

y 座標

戻り値
位置情報格納している DataGridView.HitTestInfo。

解説解説
使用例使用例

このメソッド使用方法次のコード例示します。この例は Columns プロパティリファレンス トピック取り上げている例の一部です。

Private clickedCell As DataGridViewCell

Private Sub dataGridView1_MouseDown(ByVal
 sender As Object, _
    ByVal e As MouseEventArgs) Handles
 dataGridView1.MouseDown

    ' If the user right-clicks a cell, store it for use by the 
    ' shortcut menu.
    If e.Button = MouseButtons.Right Then
        Dim hit As DataGridView.HitTestInfo
 = _
            dataGridView1.HitTest(e.X, e.Y)
        If hit.Type = DataGridViewHitTestType.Cell Then
            clickedCell = _
                dataGridView1.Rows(hit.RowIndex).Cells(hit.ColumnIndex)
        End If
    End If

End Sub
private DataGridViewCell clickedCell;

private void dataGridView1_MouseDown(object
 sender, MouseEventArgs e)
{
// If the user right-clicks a cell, store it for use by the shortcut
 menu.
    if (e.Button == MouseButtons.Right)
    {
        DataGridView.HitTestInfo hit = dataGridView1.HitTest(e.X, e.Y);
        if (hit.Type == DataGridViewHitTestType.Cell)
        {
            clickedCell =
                dataGridView1.Rows[hit.RowIndex].Cells[hit.ColumnIndex];
        }
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridView クラス
DataGridView メンバ
System.Windows.Forms 名前空間
DataGridView.HitTestInfo
DataGridViewHitTestType
その他の技術情報
DataGridView コントロール (Windows フォーム)


このページでは「.NET Framework クラス ライブラリ リファレンス」からDataGridView.HitTest メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からDataGridView.HitTest メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からDataGridView.HitTest メソッド を検索

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

辞書ショートカット

すべての辞書の索引

「DataGridView.HitTest メソッド」の関連用語

DataGridView.HitTest メソッドのお隣キーワード
検索ランキング

   

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



DataGridView.HitTest メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS