DataGridViewHitTestType 열거형

정의

DataGridView 컨트롤의 위치를 지정합니다.

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

필드

Cell 1

DataGridView의 셀입니다.

ColumnHeader 2

DataGridView의 열 머리글입니다.

HorizontalScrollBar 5

DataGridView의 가로 스크롤 막대입니다.

None 0

DataGridView의 비어 있는 부분입니다.

RowHeader 3

DataGridView의 행 머리글입니다.

TopLeftHeader 4

DataGridView의 왼쪽 위 열 머리글입니다.

VerticalScrollBar 6

DataGridView의 세로 스크롤 막대입니다.

예제

다음 코드 예제에서는이 형식의 사용을 보여 줍니다. 이 예제는에서 사용할 수 있는 보다 큰 예제의 일부는 DataGridView.Columns 속성 참조 항목입니다.

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];
        }
    }
}
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

설명

A DataGridView.HitTestInfo 좌표 쌍에 설명 합니다.는 DataGridView 제어 합니다. 합니다 Type 속성의 어느 부분을 나타냅니다는 DataGridView 지점을 포함 합니다.

적용 대상

추가 정보