DataGrid.HitTestInfo.Column Özellik
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.
Kullanıcının tıklandığı sütunun sayısını alır.
public:
property int Column { int get(); };
public int Column { get; }
member this.Column : int
Public ReadOnly Property Column As Integer
Özellik Değeri
Sütunun sayısı.
Örnekler
Aşağıdaki örnek, bir System.Windows.Forms.DataGrid denetimin olayından yöntemini MouseDown çağırarak HitTest tıklanan satır ve sütunun numaralarını yazdırır. Bu bir DataGrid.HitTestInfo nesne döndürür.
private:
void dataGrid1_MouseDown( Object^ /*sender*/,
System::Windows::Forms::MouseEventArgs^ e )
{
String^ newLine = "\n";
Console::WriteLine( newLine );
System::Windows::Forms::DataGrid::HitTestInfo^ myHitTest;
/* Use the DataGrid control's HitTest method with
the x and y properties. */
myHitTest = dataGrid1->HitTest( e->X, e->Y );
Console::WriteLine( "Column {0}", myHitTest->Column );
Console::WriteLine( "Row {0}", myHitTest->Row );
}
private void dataGrid1_MouseDown
(object sender, System.Windows.Forms.MouseEventArgs e)
{
string newLine = "\n";
Console.WriteLine(newLine);
System.Windows.Forms.DataGrid.HitTestInfo myHitTest;
/* Use the DataGrid control's HitTest method with
the x and y properties. */
myHitTest = dataGrid1.HitTest(e.X,e.Y);
Console.WriteLine("Column " + myHitTest.Column);
Console.WriteLine("Row " + myHitTest.Row);
}
Private Sub dataGrid1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
Dim newLine As String = ControlChars.Cr
Console.WriteLine(newLine)
Dim myHitTest As System.Windows.Forms.DataGrid.HitTestInfo
' Use the DataGrid control's HitTest method with
' the x and y properties.
myHitTest = dataGrid1.HitTest(e.X, e.Y)
Console.WriteLine(("Column " & myHitTest.Column))
Console.WriteLine(("Row " & myHitTest.Row))
End Sub
Açıklamalar
Koordinat bir hücre değilse, özelliği -1 döndürür.
Şunlara uygulanır
Ayrıca bkz.
Geri Bildirim
https://aka.ms/ContentUserFeedback.
Çok yakında: 2024 boyunca, içerik için geri bildirim mekanizması olarak GitHub Sorunları’nı kullanımdan kaldıracak ve yeni bir geri bildirim sistemiyle değiştireceğiz. Daha fazla bilgi için bkz.Gönderin ve geri bildirimi görüntüleyin