DataGrid.HitTestType DataGrid.HitTestType DataGrid.HitTestType DataGrid.HitTestType Enum

정의

사용자가 클릭한 DataGrid 컨트롤의 부분을 나타냅니다.Specifies the part of the DataGrid control the user has clicked.

이 열거형에는 멤버 값의 비트 조합을 허용하는 FlagsAttribute 특성이 있습니다.

public: enum class DataGrid::HitTestType
[System.Flags]
public enum DataGrid.HitTestType
type DataGrid.HitTestType = 
Public Enum DataGrid.HitTestType
상속
DataGrid.HitTestTypeDataGrid.HitTestTypeDataGrid.HitTestTypeDataGrid.HitTestType
특성

필드

Caption Caption Caption Caption 32

DataGrid 컨트롤의 캡션입니다.The caption of the DataGrid control.

Cell Cell Cell Cell 1

DataGrid 컨트롤의 셀입니다.A cell in the DataGrid control.

ColumnHeader ColumnHeader ColumnHeader ColumnHeader 2

DataGrid 컨트롤의 열 머리글입니다.A column header in the DataGrid control.

ColumnResize ColumnResize ColumnResize ColumnResize 8

열 머리글 사이에 있는 줄을 나타내는 열 테두리입니다.The column border, which is the line between column headers. 이 테두리를 끌어서 열의 너비를 조정할 수 있습니다.It can be dragged to resize a column's width.

None None None None 0

컨트롤에 테이블이 포함되어 있지 않거나, 행이 거의 없을 때, 또는 테이블을 아래쪽으로 스크롤할 때 볼 수 있는 배경 영역입니다.The background area, visible when the control contains no table, few rows, or when a table is scrolled to its bottom.

ParentRows ParentRows ParentRows ParentRows 64

DataGrid 컨트롤의 부모 행 섹션입니다.The parent row section of the DataGrid control. 부모 행에는 부모 테이블의 이름, 부모 레코드의 열 이름 및 값과 같이, 현재 표시된 자식 테이블의 부모 테이블에서 가져온 정보 또는 해당 부모 테이블에 대한 정보가 표시됩니다.The parent row displays information from or about the parent table of the currently displayed child table, such as the name of the parent table, column names and values of the parent record.

RowHeader RowHeader RowHeader RowHeader 4

DataGrid 컨트롤의 행 머리글입니다.A row header in the DataGrid control.

RowResize RowResize RowResize RowResize 16

모눈 행 머리글 사이에 있는 줄을 나타내는 행 테두리입니다.The row border, which is the line between grid row headers. 이 테두리를 끌어서 행의 높이를 조정할 수 있습니다.It can be dragged to resize a row's height.

예제

다음 예제에서는 합니다 HitTest 에서 메서드를 MouseDown 반환할 이벤트는 DataGrid.HitTestInfo합니다.The following example uses the HitTest method in a MouseDown event to return the DataGrid.HitTestInfo. 그런 다음 행, 열 및 표의 부분 인쇄 됩니다.The row, column, and part of the grid are then printed.

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( 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}", ReturnHitTest( myHitTest->Type ) );
   }

   String^ ReturnHitTest(
      System::Windows::Forms::DataGrid::HitTestType hit )
   {
      // Use this function to return the part of the grid clicked.   
      switch ( hit )
      {
      case(System::Windows::Forms::DataGrid::HitTestType::Cell):
         return "Cell";
       
      case(System::Windows::Forms::DataGrid::HitTestType::Caption):
         return "Caption";
       
      case(System::Windows::Forms::DataGrid::HitTestType::ColumnHeader):
          return "ColumnHeader";
          
      case(System::Windows::Forms::DataGrid::HitTestType::ColumnResize):
         return "Resize";
          
      case(System::Windows::Forms::DataGrid::HitTestType::ParentRows):
         return "ParentRows";
          
      case(System::Windows::Forms::DataGrid::HitTestType::RowHeader):
         return "RowHeader";
          
      case(System::Windows::Forms::DataGrid::HitTestType::RowResize):
         return "RowResize";
          
      case(System::Windows::Forms::DataGrid::HitTestType::None):
         return "None";

      default:
         return "Unknown";
      }
   }
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(myHitTest);
   Console.WriteLine("Column " + myHitTest.Column);
   Console.WriteLine("Row " + myHitTest.Row);
   Console.WriteLine("Type " + myHitTest.Type);
   Console.WriteLine("ToString " + myHitTest.ToString());
   Console.WriteLine("Hit " + ReturnHitTest(myHitTest.Type ));
}
 
 private string ReturnHitTest(System.Windows.Forms.DataGrid.HitTestType  hit ){
    // Use this function to return the part of the grid clicked.   
    switch(hit) {
    case(System.Windows.Forms.DataGrid.HitTestType.Cell):
       return "Cell";
       
       
    case(System.Windows.Forms.DataGrid.HitTestType.Caption):
       return "Caption";
       
    case(System.Windows.Forms.DataGrid.HitTestType.ColumnHeader):
        return "ColumnHeader";
          
    case(System.Windows.Forms.DataGrid.HitTestType.ColumnResize):
       return "Resize";
          
    case(System.Windows.Forms.DataGrid.HitTestType.ParentRows):
       return "ParentRows";
          
    case(System.Windows.Forms.DataGrid.HitTestType.RowHeader):
       return "RowHeader";
          
    case(System.Windows.Forms.DataGrid.HitTestType.RowResize):
       return "RowResize";
          
    case(System.Windows.Forms.DataGrid.HitTestType.None):
       return "None";
    default:return "Unknown";
    }
 }

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(myHitTest)
    Console.WriteLine(("Column " & myHitTest.Column))
    Console.WriteLine(("Row " & myHitTest.Row))
    Console.WriteLine(("Type " & myHitTest.Type))
    Console.WriteLine(("ToString " & myHitTest.ToString()))
    Console.WriteLine(("Hit " & ReturnHitTest(myHitTest.Type)))
End Sub


Private Function ReturnHitTest(hit As System.Windows.Forms.DataGrid.HitTestType) As String
    ' Use this function to return the part of the grid clicked.   
    Select Case hit
        Case System.Windows.Forms.DataGrid.HitTestType.Cell
                Return "Cell"
        
        Case System.Windows.Forms.DataGrid.HitTestType.Caption
                Return "Caption"
        
        Case System.Windows.Forms.DataGrid.HitTestType.ColumnHeader
                Return "ColumnHeader"
        
        Case System.Windows.Forms.DataGrid.HitTestType.ColumnResize
                Return "Resize"
        
        Case System.Windows.Forms.DataGrid.HitTestType.ParentRows
                Return "ParentRows"
        
        Case System.Windows.Forms.DataGrid.HitTestType.RowHeader
                Return "RowHeader"
        
        Case System.Windows.Forms.DataGrid.HitTestType.RowResize
                Return "RowResize"
        
        Case System.Windows.Forms.DataGrid.HitTestType.None
                Return "None"
        Case Else
                Return "Unknown"
    End Select
End Function 'ReturnHitTest

설명

이 열거형의 멤버를 사용 하 여 눈금의 어느 부분이 클릭 했는지 확인 합니다.Use the members of this enumeration to determine which part of the grid has been clicked. Type 의 속성을 DataGrid.HitTestInfo 반환을 DataGrid.HitTestType입니다.The Type property of a DataGrid.HitTestInfo returns a DataGrid.HitTestType. DataGrid.HitTestInfo 를 호출 하 여 만들어집니다 합니다 HitTest 메서드의 System.Windows.Forms.DataGrid 컨트롤입니다.The DataGrid.HitTestInfo is created by invoking the HitTest method of a System.Windows.Forms.DataGrid control.

적용 대상

추가 정보