DataGridCell Struktúra

Definíció

Figyelemfelhívás

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

Azonosítja a rács egyik celláját.

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
Öröklődés
DataGridCell
Attribútumok

Példák

Az alábbi példa egy DataGridCellCurrentCellSystem.Windows.Forms.DataGrid rendeli hozzá, és a kijelölt cella oszlop- és sorszámát adja vissza. A benne DataTable tárolt érték az objektum DataGridCell és RowNumbera 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

Megjegyzések

A DataGridCell a System.Windows.Forms.DataGrid vezérlőelem CurrentCell tulajdonságával együtt használható bármely cella értékének lekéréséhez vagy beállításához. Ha a System.Windows.Forms.DataGrid vezérlőelem CurrentCell tulajdonságát egy DataGridCell értékre állítja, a fókusz a DataGridCell által megadott cellára kerül.

Konstruktorok

Name Description
DataGridCell(Int32, Int32)
Elavult.

Inicializálja a DataGridCell osztály új példányát.

Tulajdonságok

Name Description
ColumnNumber
Elavult.

Lekéri vagy beállítja egy oszlop számát a DataGrid vezérlőben.

RowNumber
Elavult.

Lekéri vagy beállítja a vezérlőelem sorainak DataGrid számát.

Metódusok

Name Description
Equals(Object)
Elavult.

Egy értéket kap, amely azt jelzi, hogy a DataGridCell második DataGridCellérték megegyezik-e.

GetHashCode()
Elavult.

Lekéri a kivonat értékét, amely hozzáadható egy Hashtable.

ToString()
Elavult.

Lekéri a cella sorszámát és oszlopszámát.

A következőre érvényes:

Lásd még