DataGrid.HitTestInfo.Row 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
사용자가 클릭한 행의 수를 가져옵니다.
public:
property int Row { int get(); };
public int Row { get; }
member this.Row : int
Public ReadOnly Property Row As Integer
속성 값
클릭한 행의 수입니다.
예제
다음 예제에서는 컨트롤의 이벤트 내에서 HitTest 메서드를 호출 MouseDown 하 여 클릭 한 행과 열의 수를 인쇄 합니다System.Windows.Forms.DataGrid. 개체를 DataGrid.HitTestInfo 반환합니다.
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
설명
좌표가 셀이 아니면 속성이 -1을 반환합니다. 좌표가면 RowHeader속성은 머리글의 행 번호를 반환하지만 속성은 Column -1을 반환합니다.