DataGridCell Структура
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Внимание
DataGrid is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use DataGridView instead.
Определяет ячейку в сетке.
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
- Наследование
- Атрибуты
Примеры
В следующем примере назначается DataGridCellCurrentCell объекту a System.Windows.Forms.DataGrid и возвращается номер столбца и строки выбранной ячейки. Значение, хранящееся в объекте DataTable , также печатается с помощью DataGridCell объектов RowNumber и 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 для получения или задания значения любой ячейки. System.Windows.Forms.DataGrid Задание свойству DataGridCell элемента управления CurrentCell приводит к тому, что фокус перемещается в ячейку, указанную в элементе DataGridCellуправления.
Конструкторы
| Имя | Описание |
|---|---|
| DataGridCell(Int32, Int32) |
Устаревшие..
Инициализирует новый экземпляр класса DataGridCell. |
Свойства
| Имя | Описание |
|---|---|
| ColumnNumber |
Устаревшие..
Возвращает или задает число столбца в элементе DataGrid управления. |
| RowNumber |
Устаревшие..
Возвращает или задает число строки в элементе DataGrid управления. |
Методы
| Имя | Описание |
|---|---|
| Equals(Object) |
Устаревшие..
Возвращает значение, указывающее, идентично ли значение DataGridCell секунды DataGridCell. |
| GetHashCode() |
Устаревшие..
Возвращает хэш-значение, которое можно добавить в Hashtable. |
| ToString() |
Устаревшие..
Возвращает номер строки и номер столбца ячейки. |