DataGridViewHitTestType DataGridViewHitTestType DataGridViewHitTestType DataGridViewHitTestType Enum


DataGridView コントロール内の位置を指定します。Specifies a location in a DataGridView control.

public enum class DataGridViewHitTestType
public enum DataGridViewHitTestType
type DataGridViewHitTestType = 
Public Enum DataGridViewHitTestType


Cell Cell Cell Cell 1

DataGridView 内のセル。A cell in the DataGridView.

ColumnHeader ColumnHeader ColumnHeader ColumnHeader 2

DataGridView 内の列ヘッダー。A column header in the DataGridView.

HorizontalScrollBar HorizontalScrollBar HorizontalScrollBar HorizontalScrollBar 5

DataGridView の水平スクロール バー。The horizontal scroll bar of the DataGridView.

None None None None 0

DataGridView の空白の部分。An empty part of the DataGridView.

RowHeader RowHeader RowHeader RowHeader 3

DataGridView 内の行ヘッダー。A row header in the DataGridView.

TopLeftHeader TopLeftHeader TopLeftHeader TopLeftHeader 4

DataGridView 内の左上隅にある列ヘッダー。The top left column header in the DataGridView.

VerticalScrollBar VerticalScrollBar VerticalScrollBar VerticalScrollBar 6

DataGridView の垂直スクロール バー。The vertical scroll bar of the DataGridView.

次のコード例は、この型の使用を示しています。The following code example illustrates the use of this type. この例は例で使用できる、DataGridView.Columnsプロパティの参照トピック。This example is part of a larger example available in the DataGridView.Columns property reference topic.

   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 =
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 = _
        End If
    End If

End Sub


ADataGridView.HitTestInfoで座標ペアについて説明します、DataGridViewコントロール。A DataGridView.HitTestInfo describes a coordinate pair on the DataGridView control. Typeプロパティのどの部分を示す、DataGridViewポイントが含まれています。The Type property indicates which part of the DataGridView contains the point.