Aracılığıyla paylaş


DataGridCell Yapı

Tanım

Dikkat

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

Kılavuzdaki bir hücreyi tanımlar.

public value class DataGridCell
public struct DataGridCell
[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 struct DataGridCell
type DataGridCell = struct
[<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 DataGridCell = struct
Public Structure DataGridCell
Devralma
DataGridCell
Öznitelikler

Örnekler

Aşağıdaki örnek öğesini öğesine CurrentCellSystem.Windows.Forms.DataGrid atar DataGridCell ve seçili hücrenin sütun ve satır numarasını döndürür. içinde DataTable depolanan değer, nesnesinin DataGridCellRowNumber ve ColumnNumberkullanılarak da yazdırılır.

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

Açıklamalar

DataGridCell, herhangi bir hücrenin System.Windows.Forms.DataGrid değerini almak veya ayarlamak için denetimin CurrentCell özelliğiyle birlikte kullanılabilir. Denetimin System.Windows.Forms.DataGridCurrentCell özelliğini olarak DataGridCell ayarlamak, odağın tarafından belirtilen hücreye taşınmasına DataGridCellneden olur.

Oluşturucular

Name Description
DataGridCell(Int32, Int32)
Geçersiz.

DataGridCell sınıfının yeni bir örneğini başlatır.

Özellikler

Name Description
ColumnNumber
Geçersiz.

Denetimdeki DataGrid bir sütunun sayısını alır veya ayarlar.

RowNumber
Geçersiz.

Denetimdeki DataGrid bir satırın sayısını alır veya ayarlar.

Yöntemler

Name Description
Equals(Object)
Geçersiz.

değerinin saniyeyle DataGridCellDataGridCellaynı olup olmadığını belirten bir değer alır.

GetHashCode()
Geçersiz.

öğesine eklenebilen bir Hashtablekarma değeri alır.

ToString()
Geçersiz.

Hücrenin satır numarasını ve sütun numarasını alır.

Şunlara uygulanır

Ayrıca bkz.