DataGrid.CurrentCell 속성

정의

포커스가 있는 셀을 가져오거나 설정합니다. 디자인 타임에는 이 속성을 사용할 수 없습니다.

public:
 property System::Windows::Forms::DataGridCell CurrentCell { System::Windows::Forms::DataGridCell get(); void set(System::Windows::Forms::DataGridCell value); };
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.DataGridCell CurrentCell { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.CurrentCell : System.Windows.Forms.DataGridCell with get, set
Public Property CurrentCell As DataGridCell

속성 값

DataGridCell

포커스가 있는 DataGridCell입니다.

특성

예제

다음 코드 예제에서는 현재 셀을 설정하고 가져오는 방법을 보여줍니다.

private:
   void SetCellWithFocus( DataGrid^ myGrid )
   {
      // Set the current cell to cell1, row 1.
      myGrid->CurrentCell = DataGridCell( 1, 1 );
   }

   void dataGrid1_GotFocus( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      Console::WriteLine( "{0} {1}", dataGrid1->CurrentCell.ColumnNumber,
         dataGrid1->CurrentCell.RowNumber );
   }
private void SetCellWithFocus(DataGrid myGrid)
 {
    // Set the current cell to cell1, row 1.
    myGrid.CurrentCell = new DataGridCell(1,1);
 }
 
 private void dataGrid1_GotFocus(object sender, EventArgs e)
 {
    Console.WriteLine(dataGrid1.CurrentCell.ColumnNumber + 
    " " + dataGrid1.CurrentCell.RowNumber);
 }
Private Sub SetCellWithFocus(ByVal myGrid As DataGrid)
    ' Set the current cell to cell 1, row 1.
    myGrid.CurrentCell = New DataGridCell(1,1)
 End Sub
 
 Private Sub DataGrid1_GotFocus(ByVal Sender As Object, ByVal e As EventArgs)
    Console.WriteLine(DataGrid1.CurrentCell.ColumnNumber & " " & _
       DataGrid1.CurrentCell.RowNumber)
 End Sub

설명

CurrentCell 속성을 설정하면 표가 스크롤되고 셀이 표시되지 않는 경우 셀이 표시됩니다.

적용 대상

추가 정보