DataGridViewHitTestType Sabit listesi
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Denetimde DataGridView bir konum belirtir.
public enum class DataGridViewHitTestType
public enum DataGridViewHitTestType
type DataGridViewHitTestType =
Public Enum DataGridViewHitTestType
- Devralma
Alanlar
Cell | 1 | içindeki DataGridViewbir hücre. |
ColumnHeader | 2 | içinde DataGridViewbir sütun başlığı. |
HorizontalScrollBar | 5 | öğesinin DataGridViewyatay kaydırma çubuğu. |
None | 0 | öğesinin boş bir DataGridViewbölümü. |
RowHeader | 3 | içinde DataGridViewbir satır üst bilgisi. |
TopLeftHeader | 4 | içinde sol üst sütun başlığı DataGridView. |
VerticalScrollBar | 6 | öğesinin DataGridViewdikey kaydırma çubuğu. |
Örnekler
Aşağıdaki kod örneğinde bu türün kullanımı gösterilmektedir. Bu örnek, özellik başvurusu konusunda bulunan DataGridView.Columns daha büyük bir örneğin bir parçasıdır.
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çıklamalar
, DataGridView.HitTestInfo denetimdeki bir koordinat çiftini DataGridView açıklar. özelliği, Type öğesinin hangi bölümünün DataGridView noktayı içerdiğini gösterir.