다음을 통해 공유


DataGrid.HitTestInfo 클래스

정의

주의

DataGrid is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use DataGridView instead.

지정된 좌표의 DataGrid 일부에 대한 정보를 포함합니다. 이 클래스는 상속할 수 없습니다.

public: ref class DataGrid::HitTestInfo sealed
public sealed class DataGrid.HitTestInfo
[System.ComponentModel.Browsable(false)]
[System.Obsolete("`DataGrid` is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use `DataGridView` instead.", false, DiagnosticId="WFDEV006", UrlFormat="https://aka.ms/winforms-warnings/{0}")]
public sealed class DataGrid.HitTestInfo
type DataGrid.HitTestInfo = class
[<System.ComponentModel.Browsable(false)>]
[<System.Obsolete("`DataGrid` is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use `DataGridView` instead.", false, DiagnosticId="WFDEV006", UrlFormat="https://aka.ms/winforms-warnings/{0}")>]
type DataGrid.HitTestInfo = class
Public NotInheritable Class DataGrid.HitTestInfo
상속
DataGrid.HitTestInfo
특성

예제

다음 예제에서는 개체를 HitTestMouseDown 반환 하는 이벤트에서 메서드를 DataGrid.HitTestInfo 사용 합니다. 그런 다음 표의 행, 열 및 일부가 인쇄됩니다.

private:
   void dataGrid1_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e )
   {
      Console::WriteLine();
      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( myHitTest );
      Console::WriteLine( "Column {0}", myHitTest->Column );
      Console::WriteLine( "Row {0}", myHitTest->Row );
      Console::WriteLine( "Type {0}", myHitTest->Type );
      Console::WriteLine( "ToString {0}", myHitTest );
      Console::WriteLine( "Hit {0}", myHitTest->Type );
   }
private void dataGrid1_MouseDown
(object sender, System.Windows.Forms.MouseEventArgs e)
{
   Console.WriteLine();
   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(myHitTest);
   Console.WriteLine("Column " + myHitTest.Column);
   Console.WriteLine("Row " + myHitTest.Row);
   Console.WriteLine("Type " + myHitTest.Type);
   Console.WriteLine("ToString " + myHitTest.ToString());
   Console.WriteLine("Hit " + myHitTest.Type.ToString());
}
Private Sub DataGrid1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)
    Console.WriteLine()
    Dim myHitTest As 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)
    Console.WriteLine("Type " & myHitTest.Type)
    Console.WriteLine("ToString " & myHitTest.ToString)
    Console.WriteLine("Format " & myHitTest.Type.ToString)
End Sub

설명

클래스는 DataGrid.HitTestInfo 컨트롤의 DataGrid 메서드와 함께 HitTest 사용자가 클릭한 컨트롤의 DataGrid 일부를 결정하는 데 사용됩니다. 클래스에는 DataGrid.HitTestInfo 클릭한 표의 행, 열 및 일부가 포함됩니다. 그리드 부분의 DataGrid.HitTestType 전체 목록은 속성에서 Type 반환하는 열거형을 참조하세요.

반환DataGrid.HitTestInfo하려면 컨트롤 이벤트에서 HitTestDataGrid 메서드를 MouseDown 호출합니다. 메서드의 x 속성과 y 속성을 MouseEventArgs 전달합니다 HitTest .

필드

Name Description
Nowhere
사용되지 않음.

좌표가 작동하지 않는 컨트롤의 DataGrid 일부에 해당한다는 것을 나타냅니다.

속성

Name Description
Column
사용되지 않음.

사용자가 클릭한 열의 수를 가져옵니다.

Row
사용되지 않음.

사용자가 클릭한 행의 수를 가져옵니다.

Type
사용되지 않음.

클릭한 행이나 열 이외의 컨트롤 부분을 DataGrid 가져옵니다.

메서드

Name Description
Equals(Object)
사용되지 않음.

두 개체가 동일한지 여부를 나타냅니다.

GetHashCode()
사용되지 않음.

인스턴스의 해시 코드를 DataGrid.HitTestInfo 가져옵니다.

GetType()
사용되지 않음.

현재 인스턴스의 Type 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()
사용되지 않음.

현재 Object단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()
사용되지 않음.

형식, 행 번호 및 열 번호를 가져옵니다.

적용 대상

추가 정보