DataGridCell DataGridCell DataGridCell DataGridCell Struct

정의

모눈의 셀을 식별합니다.Identifies a cell in the grid.

public value class DataGridCell
public struct DataGridCell
type DataGridCell = struct
Public Structure DataGridCell
상속
DataGridCellDataGridCellDataGridCellDataGridCell

예제

다음 예제에서는 합니다 DataGridCellCurrentCellSystem.Windows.Forms.DataGrid 선택된 된 셀의 열 및 행 수를 반환 합니다.The following example assigns the DataGridCell to the CurrentCell of a System.Windows.Forms.DataGrid and returns the column and row number of the selected cell. 에 저장 된 값을 DataTable 를 사용 하 여 인쇄 되어 합니다 DataGridCell 개체의 RowNumberColumnNumber합니다.The value stored in the DataTable is also printed using the DataGridCell object's RowNumber and ColumnNumber.

void PrintCellRowAndCol()
{
   DataGridCell^ myCell;
   myCell = DataGrid1->CurrentCell;
   Console::WriteLine( myCell->RowNumber );
   Console::WriteLine( myCell->ColumnNumber );
   
   // Prints the value of the cell through the DataTable.
   DataTable^ myTable;
   
   // Assumes the DataGrid is bound to a DataTable.
   myTable = dynamic_cast<DataTable^>(DataGrid1->DataSource);
   Console::WriteLine( myTable->Rows[ myCell->RowNumber ][ myCell->ColumnNumber ] );
}

private void PrintCellRowAndCol()
{
   DataGridCell myCell;
   myCell = DataGrid1.CurrentCell;
   Console.WriteLine(myCell.RowNumber);
   Console.WriteLine(myCell.ColumnNumber);
   // Prints the value of the cell through the DataTable.
   DataTable myTable;
   // Assumes the DataGrid is bound to a DataTable.
   myTable = (DataTable) DataGrid1.DataSource;
   Console.WriteLine(myTable.Rows[myCell.RowNumber]
   [myCell.ColumnNumber]);
}

Private Sub PrintCellRowAndCol()
    Dim myCell As DataGridCell
    myCell = DataGrid1.CurrentCell
    Console.WriteLine(myCell.RowNumber)
    Console.WriteLine(myCell.ColumnNumber)
    ' Prints the value of the cell through the DataTable.
    Dim myTable As DataTable
    ' Assumes the DataGrid is bound to a DataTable.
    myTable = CType(DataGrid1.DataSource, DataTable)
    Console.WriteLine(myTable.Rows(myCell.RowNumber)(myCell.ColumnNumber))
 End Sub

설명

합니다 DataGridCell 와 함께에서 사용할 수는 System.Windows.Forms.DataGrid 컨트롤의 CurrentCell 속성을 셀의 값을 가져오거나 설정 합니다.The DataGridCell can be used in conjunction with the System.Windows.Forms.DataGrid control's CurrentCell property to get or set the value of any cell. 설정 된 System.Windows.Forms.DataGrid 컨트롤의 CurrentCell 속성을를 DataGridCell 포커스가 지정 되는 셀을 이동 하면는 DataGridCell합니다.Setting the System.Windows.Forms.DataGrid control's CurrentCell property to a DataGridCell causes the focus to move to the cell specified by the DataGridCell.

생성자

DataGridCell(Int32, Int32) DataGridCell(Int32, Int32) DataGridCell(Int32, Int32) DataGridCell(Int32, Int32)

DataGridCell 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the DataGridCell class.

속성

ColumnNumber ColumnNumber ColumnNumber ColumnNumber

DataGrid 컨트롤의 열 번호를 가져오거나 설정합니다.Gets or sets the number of a column in the DataGrid control.

RowNumber RowNumber RowNumber RowNumber

DataGrid 컨트롤의 행 번호를 가져오거나 설정합니다.Gets or sets the number of a row in the DataGrid control.

메서드

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

DataGridCell이 두 번째 DataGridCell과 동일한지 여부를 나타내는 값을 가져옵니다.Gets a value indicating whether the DataGridCell is identical to a second DataGridCell.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Hashtable에 추가할 수 있는 해시 값을 가져옵니다.Gets a hash value that can be added to a Hashtable.

ToString() ToString() ToString() ToString()

셀의 행 번호 및 열 번호를 가져옵니다.Gets the row number and column number of the cell.

적용 대상

추가 정보