.NET Framework Class Library DataGridViewImageCell Class

Inheritance Hierarchy
Namespace:
System.Windows.Forms
Assembly:
System.Windows.Forms (in System.Windows.Forms.dll)

Syntax
Public Class DataGridViewImageCell _
Inherits DataGridViewCell
public class DataGridViewImageCell : DataGridViewCell
public ref class DataGridViewImageCell : public DataGridViewCell
type DataGridViewImageCell =
class
inherit DataGridViewCell
end
The DataGridViewImageCell type exposes the following members.

Constructors

Properties

Methods
|
| Name | Description |
|---|
.gif) | AdjustCellBorderStyle | Modifies the input cell border style according to the specified criteria. (Inherited from DataGridViewCell.) | .gif) | BorderWidths | Returns a Rectangle that represents the widths of all the cell margins. (Inherited from DataGridViewCell.) | .gif) | ClickUnsharesRow | Indicates whether the cell's row will be unshared when the cell is clicked. (Inherited from DataGridViewCell.) | .gif) | Clone | Creates an exact copy of this cell. (Overrides DataGridViewCell..::.Clone()()().) | .gif) | ContentClickUnsharesRow | Indicates whether the cell's row will be unshared when the cell's content is clicked. (Inherited from DataGridViewCell.) | .gif) | ContentDoubleClickUnsharesRow | Indicates whether the cell's row will be unshared when the cell's content is double-clicked. (Inherited from DataGridViewCell.) | .gif) | CreateAccessibilityInstance | Creates a new accessible object for the DataGridViewImageCell. (Overrides DataGridViewCell..::.CreateAccessibilityInstance()()().) | .gif) | DetachEditingControl | Removes the cell's editing control from the DataGridView. (Inherited from DataGridViewCell.) | .gif) | Dispose()()() | Releases all resources used by the DataGridViewCell. (Inherited from DataGridViewCell.) | .gif) | Dispose(Boolean) | Releases the unmanaged resources used by the DataGridViewCell and optionally releases the managed resources. (Inherited from DataGridViewCell.) | .gif) | DoubleClickUnsharesRow | Indicates whether the cell's row will be unshared when the cell is double-clicked. (Inherited from DataGridViewCell.) | .gif) | EnterUnsharesRow | Indicates whether the parent row will be unshared when the focus moves to the cell. (Inherited from DataGridViewCell.) | .gif) | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | .gif) | Finalize | Releases the unmanaged resources and performs other cleanup operations before the DataGridViewCell is reclaimed by garbage collection. (Inherited from DataGridViewCell.) | .gif) | GetClipboardContent | Retrieves the formatted value of the cell to copy to the Clipboard. (Inherited from DataGridViewCell.) | .gif) | GetContentBounds(Int32) | Returns the bounding rectangle that encloses the cell's content area using a default Graphics and cell style currently in effect for the cell. (Inherited from DataGridViewCell.) | .gif) | GetContentBounds(Graphics, DataGridViewCellStyle, Int32) | Returns the bounding rectangle that encloses the cell's content area, which is calculated using the specified Graphics and cell style. (Overrides DataGridViewCell..::.GetContentBounds(Graphics, DataGridViewCellStyle, Int32).) | .gif) | GetEditedFormattedValue | Returns the current, formatted value of the cell, regardless of whether the cell is in edit mode and the value has not been committed. (Inherited from DataGridViewCell.) | .gif) | GetErrorIconBounds | Returns the bounding rectangle that encloses the cell's error icon, if one is displayed. (Overrides DataGridViewCell..::.GetErrorIconBounds(Graphics, DataGridViewCellStyle, Int32).) | .gif) | GetErrorText | Returns a string that represents the error for the cell. (Inherited from DataGridViewCell.) | .gif) | GetFormattedValue | Returns a graphic as it would be displayed in the cell. (Overrides DataGridViewCell..::.GetFormattedValue(Object, Int32, DataGridViewCellStyle%, TypeConverter, TypeConverter, DataGridViewDataErrorContexts).) | .gif) | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | .gif) | GetInheritedContextMenuStrip | Gets the inherited shortcut menu for the current cell. (Inherited from DataGridViewCell.) | .gif) | GetInheritedState | Returns a value indicating the current state of the cell as inherited from the state of its row and column. (Inherited from DataGridViewCell.) | .gif) | GetInheritedStyle | Gets the style applied to the cell. (Inherited from DataGridViewCell.) | .gif) | GetPreferredSize | Calculates the preferred size, in pixels, of the cell. (Overrides DataGridViewCell..::.GetPreferredSize(Graphics, DataGridViewCellStyle, Int32, Size).) | .gif) | GetSize | Gets the size of the cell. (Inherited from DataGridViewCell.) | .gif) | GetType | Gets the Type of the current instance. (Inherited from Object.) | .gif) | GetValue | Gets the value of the cell. (Overrides DataGridViewCell..::.GetValue(Int32).) | .gif) | InitializeEditingControl | Initializes the control used to edit the cell. (Inherited from DataGridViewCell.) | .gif) | KeyDownUnsharesRow | Indicates whether the parent row is unshared if the user presses a key while the focus is on the cell. (Inherited from DataGridViewCell.) | .gif) | KeyEntersEditMode | Determines if edit mode should be started based on the given key. (Inherited from DataGridViewCell.) | .gif) | KeyPressUnsharesRow | Indicates whether a row will be unshared if a key is pressed while a cell in the row has focus. (Inherited from DataGridViewCell.) | .gif) | KeyUpUnsharesRow | Indicates whether the parent row is unshared when the user releases a key while the focus is on the cell. (Inherited from DataGridViewCell.) | .gif) | LeaveUnsharesRow | Indicates whether a row will be unshared when the focus leaves a cell in the row. (Inherited from DataGridViewCell.) | .gif) | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | .gif) | MouseClickUnsharesRow | Indicates whether a row will be unshared if the user clicks a mouse button while the pointer is on a cell in the row. (Inherited from DataGridViewCell.) | .gif) | MouseDoubleClickUnsharesRow | Indicates whether a row will be unshared if the user double-clicks a cell in the row. (Inherited from DataGridViewCell.) | .gif) | MouseDownUnsharesRow | Indicates whether a row will be unshared when the user holds down a mouse button while the pointer is on a cell in the row. (Inherited from DataGridViewCell.) | .gif) | MouseEnterUnsharesRow | Indicates whether a row will be unshared when the mouse pointer moves over a cell in the row. (Inherited from DataGridViewCell.) | .gif) | MouseLeaveUnsharesRow | Indicates whether a row will be unshared when the mouse pointer leaves the row. (Inherited from DataGridViewCell.) | .gif) | MouseMoveUnsharesRow | Indicates whether a row will be unshared when the mouse pointer moves over a cell in the row. (Inherited from DataGridViewCell.) | .gif) | MouseUpUnsharesRow | Indicates whether a row will be unshared when the user releases a mouse button while the pointer is on a cell in the row. (Inherited from DataGridViewCell.) | .gif) | OnClick | Called when the cell is clicked. (Inherited from DataGridViewCell.) | .gif) | OnContentClick | Called when the cell's contents are clicked. (Inherited from DataGridViewCell.) | .gif) | OnContentDoubleClick | Called when the cell's contents are double-clicked. (Inherited from DataGridViewCell.) | .gif) | OnDataGridViewChanged | Called when the DataGridView property of the cell changes. (Inherited from DataGridViewCell.) | .gif) | OnDoubleClick | Called when the cell is double-clicked. (Inherited from DataGridViewCell.) | .gif) | OnEnter | Called when the focus moves to a cell. (Inherited from DataGridViewCell.) | .gif) | OnKeyDown | Called when a character key is pressed while the focus is on a cell. (Inherited from DataGridViewCell.) | .gif) | OnKeyPress | Called when a key is pressed while the focus is on a cell. (Inherited from DataGridViewCell.) | .gif) | OnKeyUp | Called when a character key is released while the focus is on a cell. (Inherited from DataGridViewCell.) | .gif) | OnLeave | Called when the focus moves from a cell. (Inherited from DataGridViewCell.) | .gif) | OnMouseClick | Called when the user clicks a mouse button while the pointer is on a cell. (Inherited from DataGridViewCell.) | .gif) | OnMouseDoubleClick | Called when the user double-clicks a mouse button while the pointer is on a cell. (Inherited from DataGridViewCell.) | .gif) | OnMouseDown | Called when the user holds down a mouse button while the pointer is on a cell. (Inherited from DataGridViewCell.) | .gif) | OnMouseEnter | Called when the mouse pointer moves over a cell. (Inherited from DataGridViewCell.) | .gif) | OnMouseLeave | Called when the mouse pointer leaves the cell. (Inherited from DataGridViewCell.) | .gif) | OnMouseMove | Called when the mouse pointer moves within a cell. (Inherited from DataGridViewCell.) | .gif) | OnMouseUp | Called when the user releases a mouse button while the pointer is on a cell. (Inherited from DataGridViewCell.) | .gif) | Paint | Paints the current DataGridViewImageCell. (Overrides DataGridViewCell..::.Paint(Graphics, Rectangle, Rectangle, Int32, DataGridViewElementStates, Object, Object, String, DataGridViewCellStyle, DataGridViewAdvancedBorderStyle, DataGridViewPaintParts).) | .gif) | PaintBorder | Paints the border of the current DataGridViewCell. (Inherited from DataGridViewCell.) | .gif) | PaintErrorIcon | Paints the error icon of the current DataGridViewCell. (Inherited from DataGridViewCell.) | .gif) | ParseFormattedValue | Converts a value formatted for display to an actual cell value. (Inherited from DataGridViewCell.) | .gif) | PositionEditingControl | Sets the location and size of the editing control hosted by a cell in the DataGridView control. (Inherited from DataGridViewCell.) | .gif) | PositionEditingPanel | Sets the location and size of the editing panel hosted by the cell, and returns the normal bounds of the editing control within the editing panel. (Inherited from DataGridViewCell.) | .gif) | RaiseCellClick | Raises the DataGridView..::.CellClick event. (Inherited from DataGridViewElement.) | .gif) | RaiseCellContentClick | Raises the DataGridView..::.CellContentClick event. (Inherited from DataGridViewElement.) | .gif) | RaiseCellContentDoubleClick | Raises the DataGridView..::.CellContentDoubleClick event. (Inherited from DataGridViewElement.) | .gif) | RaiseCellValueChanged | Raises the DataGridView..::.CellValueChanged event. (Inherited from DataGridViewElement.) | .gif) | RaiseDataError | Raises the DataGridView..::.DataError event. (Inherited from DataGridViewElement.) | .gif) | RaiseMouseWheel | Raises the Control..::.MouseWheel event. (Inherited from DataGridViewElement.) | .gif) | SetValue | Sets the value of the cell. (Inherited from DataGridViewCell.) | .gif) | ToString | Returns a string that describes the current object. (Overrides DataGridViewCell..::.ToString()()().) | Top

Remarks
The DataGridViewImageCell class is a specialized type of DataGridViewCell used to display an Image or an Icon, depending on the value of the ValueIsIcon property. Typically, the ReadOnly property of a DataGridViewImageCell is set to true to indicate that the user cannot edit the cell contents. The DataGridViewImageColumn is the column type specialized to hold cells of this type. By default, the DataGridViewImageColumn..::.CellTemplate is initialized to a new DataGridViewImageCell. To pattern the cells within a column after an existing DataGridViewImageCell, set the column's CellTemplate property to the cell to use as a pattern. The cell-related properties of the column are wrappers for the similarly-named properties of the template cell. Changing the property values of the template cell will affect only cells based on the template that are added after the change. Changing the cell-related property values of the column, however, will update the template cell and all other cells in the column, and refresh the column display if necessary. Notes to InheritorsWhen you derive from DataGridViewImageCell and add new properties to the derived class, be sure to override the Clone method to copy the new properties during cloning operations. You should also call the base class's Clone method so that the properties of the base class are copied to the new cell.

Examples
The following code example demonstrates how to change the image in an image cell using DataGridViewCell. This code example is part of a larger example provided for the topic How to: Work with Image Columns in the Windows Forms DataGridView Control.
Private Sub dataGridView1_CellClick(ByVal sender As Object, _
ByVal e As DataGridViewCellEventArgs) _
Handles dataGridView1.CellClick
If turn.Text.Equals(gameOverString) Then Return
Dim cell As DataGridViewImageCell = _
CType(dataGridView1.Rows(e.RowIndex). _
Cells(e.ColumnIndex), DataGridViewImageCell)
If (cell.Value Is blank) Then
If IsOsTurn() Then
cell.Value = o
Else
cell.Value = x
End If
ToggleTurn()
ToolTip(e)
End If
If IsAWin() Then
turn.Text = gameOverString
End If
End Sub
private void dataGridView1_CellClick(object sender,
DataGridViewCellEventArgs e)
{
if (turn.Text.Equals(gameOverString)) { return; }
DataGridViewImageCell cell = (DataGridViewImageCell)
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
if (cell.Value == blank)
{
if (IsOsTurn())
{
cell.Value = o;
}
else
{
cell.Value = x;
}
ToggleTurn();
}
if (IsAWin())
{
turn.Text = gameOverString;
}
}
void dataGridView1_CellClick( Object^ sender, DataGridViewCellEventArgs^ e )
{
if ( turn->Equals( gameOverString ) )
{
return;
}
DataGridViewImageCell^ cell = dynamic_cast<DataGridViewImageCell^>(dataGridView1->Rows[ e->RowIndex ]->Cells[ e->ColumnIndex ]);
if ( cell->Value == blank )
{
if ( IsOsTurn() )
{
cell->Value = o;
}
else
{
cell->Value = x;
}
ToggleTurn();
}
if ( IsAWin( cell ) )
{
turn->Text = gameOverString;
}
}

Version Information
.NET FrameworkSupported in: 4, 3.5, 3.0, 2.0 .NET Framework Client ProfileSupported in: 4, 3.5 SP1

Platforms
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Thread Safety
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also
|
Biblioteca de clases de .NET Framework DataGridViewImageCell (Clase)

Jerarquía de herencia
Espacio de nombres:
System.Windows.Forms
Ensamblado:
System.Windows.Forms (en System.Windows.Forms.dll)

Sintaxis
Public Class DataGridViewImageCell _
Inherits DataGridViewCell
public class DataGridViewImageCell : DataGridViewCell
public ref class DataGridViewImageCell : public DataGridViewCell
type DataGridViewImageCell =
class
inherit DataGridViewCell
end
El tipo DataGridViewImageCell expone los siguientes miembros.

Propiedades

Métodos
|
| Nombre | Descripción |
|---|
.gif) | AdjustCellBorderStyle | Modifica el estilo de borde de celda de entrada según los criterios especificados. (Se hereda de DataGridViewCell). | .gif) | BorderWidths | Devuelve un objeto Rectangle que representa el ancho de todos los márgenes de la celda. (Se hereda de DataGridViewCell). | .gif) | ClickUnsharesRow | Indica si la fila de la celda dejará de estar compartida al hacer clic en la celda. (Se hereda de DataGridViewCell). | .gif) | Clone | Crea una copia exacta de esta celda. (Invalida a DataGridViewCell..::.Clone()()()). | .gif) | ContentClickUnsharesRow | Indica si la fila de la celda dejará de estar compartida al hacer clic en el contenido de la celda. (Se hereda de DataGridViewCell). | .gif) | ContentDoubleClickUnsharesRow | Indica si la fila de la celda dejará de estar compartida al hacer doble clic en el contenido de la celda. (Se hereda de DataGridViewCell). | .gif) | CreateAccessibilityInstance | Crea un nuevo objeto accesible para el control DataGridViewImageCell. (Invalida a DataGridViewCell..::.CreateAccessibilityInstance()()()). | .gif) | DetachEditingControl | Quita el control de edición de la celda de DataGridView. (Se hereda de DataGridViewCell). | .gif) | Dispose()()() | Libera todos los recursos utilizados por el objeto DataGridViewCell. (Se hereda de DataGridViewCell). | .gif) | Dispose(Boolean) | Libera los recursos no administrados que utiliza DataGridViewCell y, opcionalmente, libera los recursos administrados. (Se hereda de DataGridViewCell). | .gif) | DoubleClickUnsharesRow | Indica si la fila de la celda dejará de estar compartida al hacer doble clic en la celda. (Se hereda de DataGridViewCell). | .gif) | EnterUnsharesRow | Indica si la fila primaria va a dejar de estar compartida cuando el foco se desplace a la celda. (Se hereda de DataGridViewCell). | .gif) | Equals(Object) | Determina si el objeto Object especificado es igual al objeto Object actual. (Se hereda de Object). | .gif) | Finalize | Libera los recursos no administrados y realiza otras operaciones de limpieza antes de que el recolector de elementos no utilizados reclame DataGridViewCell. (Se hereda de DataGridViewCell). | .gif) | GetClipboardContent | Recupera el valor con formato de la celda que copiar en el Clipboard. (Se hereda de DataGridViewCell). | .gif) | GetContentBounds(Int32) | Devuelve el rectángulo delimitador que rodea el área de contenido de la celda utilizando un objeto Graphics predeterminado y el estilo de celda actualmente en vigor para la celda. (Se hereda de DataGridViewCell). | .gif) | GetContentBounds(Graphics, DataGridViewCellStyle, Int32) | Devuelve el rectángulo delimitador que rodea el área de contenido de la celda, que se calcula utilizando el objeto Graphics especificado y el estilo de celda. (Invalida a DataGridViewCell..::.GetContentBounds(Graphics, DataGridViewCellStyle, Int32)). | .gif) | GetEditedFormattedValue | Devuelve el valor actual con formato de la celda, con independencia de si la celda está en modo de edición y no se ha confirmado el valor. (Se hereda de DataGridViewCell). | .gif) | GetErrorIconBounds | Devuelve el rectángulo delimitador que rodea el icono de error de la celda, si se muestra alguno. (Invalida a DataGridViewCell..::.GetErrorIconBounds(Graphics, DataGridViewCellStyle, Int32)). | .gif) | GetErrorText | Devuelve una cadena que representa el error para la celda. (Se hereda de DataGridViewCell). | .gif) | GetFormattedValue | Devuelve un gráfico tal como se mostraría en la celda. (Invalida a DataGridViewCell..::.GetFormattedValue(Object, Int32, DataGridViewCellStyle%, TypeConverter, TypeConverter, DataGridViewDataErrorContexts)). | .gif) | GetHashCode | Actúa como función hash para un tipo concreto. (Se hereda de Object). | .gif) | GetInheritedContextMenuStrip | Obtiene el menú contextual heredado para la celda actual. (Se hereda de DataGridViewCell). | .gif) | GetInheritedState | Devuelve un valor que indica el estado actual de la celda tal como lo hereda del estado de su fila y columna. (Se hereda de DataGridViewCell). | .gif) | GetInheritedStyle | Obtiene el estilo aplicado a la celda. (Se hereda de DataGridViewCell). | .gif) | GetPreferredSize | Calcula el tamaño preferido, en píxeles, de la celda. (Invalida a DataGridViewCell..::.GetPreferredSize(Graphics, DataGridViewCellStyle, Int32, Size)). | .gif) | GetSize | Obtiene el tamaño de la celda. (Se hereda de DataGridViewCell). | .gif) | GetType | Obtiene el objeto Type de la instancia actual. (Se hereda de Object). | .gif) | GetValue | Obtiene el valor de la celda. (Invalida a DataGridViewCell..::.GetValue(Int32)). | .gif) | InitializeEditingControl | Inicializa el control utilizado para editar la celda. (Se hereda de DataGridViewCell). | .gif) | KeyDownUnsharesRow | Indica si la fila primaria deja de estar compartida cuando el usuario presiona una tecla mientras el foco está en la celda. (Se hereda de DataGridViewCell). | .gif) | KeyEntersEditMode | Determina si el modo de edición se debe iniciar basándose en la clave dada. (Se hereda de DataGridViewCell). | .gif) | KeyPressUnsharesRow | Indica si una fila va a dejar de estar compartida cuando se presiona una tecla mientras el foco está en una celda de la fila. (Se hereda de DataGridViewCell). | .gif) | KeyUpUnsharesRow | Indica si la fila primaria deja de estar compartida cuando el usuario libera una tecla mientras el foco está en la celda. (Se hereda de DataGridViewCell). | .gif) | LeaveUnsharesRow | Indica si una fila va a dejar de estar compartida cuando el foco abandone una celda de la fila. (Se hereda de DataGridViewCell). | .gif) | MemberwiseClone | Crea una copia superficial del objeto Object actual. (Se hereda de Object). | .gif) | MouseClickUnsharesRow | Indica si una fila va a dejar de estar compartida cuando el usuario haga clic en un botón del mouse mientras el puntero está en una celda de la fila. (Se hereda de DataGridViewCell). | .gif) | MouseDoubleClickUnsharesRow | Indica si una fila va a dejar de estar compartida cuando el usuario haga doble clic en una celda de la fila. (Se hereda de DataGridViewCell). | .gif) | MouseDownUnsharesRow | Indica si una fila va a dejar de estar compartida cuando el usuario mantiene presionado un botón del mouse mientras el puntero está en una celda de la fila. (Se hereda de DataGridViewCell). | .gif) | MouseEnterUnsharesRow | Indica si una fila va a dejar de estar compartida cuando el puntero del mouse se sitúe sobre una celda de la fila. (Se hereda de DataGridViewCell). | .gif) | MouseLeaveUnsharesRow | Indica si una fila va a dejar de estar compartida cuando el puntero del mouse salga de la fila. (Se hereda de DataGridViewCell). | .gif) | MouseMoveUnsharesRow | Indica si una fila va a dejar de estar compartida cuando el puntero del mouse se sitúe sobre una celda de la fila. (Se hereda de DataGridViewCell). | .gif) | MouseUpUnsharesRow | Indica si una fila va a dejar de estar compartida cuando el usuario suelta un botón del mouse mientras el puntero está en una celda de la fila. (Se hereda de DataGridViewCell). | .gif) | OnClick | Se le llama al hacer clic en la celda. (Se hereda de DataGridViewCell). | .gif) | OnContentClick | Se le llama al hacer clic en el contenido de la celda. (Se hereda de DataGridViewCell). | .gif) | OnContentDoubleClick | Se le llama al hacer doble clic en el contenido de la celda. (Se hereda de DataGridViewCell). | .gif) | OnDataGridViewChanged | Se le llama cuando cambia la propiedad DataGridView de la celda. (Se hereda de DataGridViewCell). | .gif) | OnDoubleClick | Se le llama al hacer doble clic en la celda. (Se hereda de DataGridViewCell). | .gif) | OnEnter | Se le llama cuando el foco se desplaza a una celda. (Se hereda de DataGridViewCell). | .gif) | OnKeyDown | Se le llama cuando se presiona una tecla de carácter mientras el foco está en una celda. (Se hereda de DataGridViewCell). | .gif) | OnKeyPress | Se le llama cuando se presiona una tecla mientras el foco está en una celda. (Se hereda de DataGridViewCell). | .gif) | OnKeyUp | Se le llama cuando se suelta una tecla de carácter mientras el foco está en una celda. (Se hereda de DataGridViewCell). | .gif) | OnLeave | Se le llama cuando el foco se desplaza de una celda. (Se hereda de DataGridViewCell). | .gif) | OnMouseClick | Se le llama cuando el usuario hace clic en un botón del mouse mientras el puntero está en una celda. (Se hereda de DataGridViewCell). | .gif) | OnMouseDoubleClick | Se le llama cuando el usuario hace clic en un botón del mouse mientras el puntero está en una celda. (Se hereda de DataGridViewCell). | .gif) | OnMouseDown | Se le llama cuando el usuario mantiene presionado un botón del mouse mientras el puntero está en una celda. (Se hereda de DataGridViewCell). | .gif) | OnMouseEnter | Se le llama cuando el puntero del mouse se mueve sobre una celda. (Se hereda de DataGridViewCell). | .gif) | OnMouseLeave | Se le llama cuando el puntero del mouse sale de la celda. (Se hereda de DataGridViewCell). | .gif) | OnMouseMove | Se le llama cuando el puntero del mouse se mueve dentro de una celda. (Se hereda de DataGridViewCell). | .gif) | OnMouseUp | Se le llama cuando el usuario suelta un botón del mouse mientras el puntero está en una celda. (Se hereda de DataGridViewCell). | .gif) | Paint | Dibuja la celda DataGridViewImageCell actual. (Invalida a DataGridViewCell..::.Paint(Graphics, Rectangle, Rectangle, Int32, DataGridViewElementStates, Object, Object, String, DataGridViewCellStyle, DataGridViewAdvancedBorderStyle, DataGridViewPaintParts)). | .gif) | PaintBorder | Dibuja el borde del control DataGridViewCell actual. (Se hereda de DataGridViewCell). | .gif) | PaintErrorIcon | Dibuja el icono de error del control DataGridViewCell actual. (Se hereda de DataGridViewCell). | .gif) | ParseFormattedValue | Convierte un valor con formato de presentación en un valor de celda real. (Se hereda de DataGridViewCell). | .gif) | PositionEditingControl | Establece la ubicación y tamaño del control de edición que hospeda una celda del control DataGridView. (Se hereda de DataGridViewCell). | .gif) | PositionEditingPanel | Establece la ubicación y tamaño del panel de edición que hospeda la celda y devuelve los límites normales del control de edición dentro del panel de edición. (Se hereda de DataGridViewCell). | .gif) | RaiseCellClick | Provoca el evento DataGridView..::.CellClick. (Se hereda de DataGridViewElement). | .gif) | RaiseCellContentClick | Genera el evento DataGridView..::.CellContentClick. (Se hereda de DataGridViewElement). | .gif) | RaiseCellContentDoubleClick | Genera el evento DataGridView..::.CellContentDoubleClick. (Se hereda de DataGridViewElement). | .gif) | RaiseCellValueChanged | Genera el evento DataGridView..::.CellValueChanged. (Se hereda de DataGridViewElement). | .gif) | RaiseDataError | Genera el evento DataGridView..::.DataError. (Se hereda de DataGridViewElement). | .gif) | RaiseMouseWheel | Provoca el evento Control..::.MouseWheel. (Se hereda de DataGridViewElement). | .gif) | SetValue | Establece el valor de la celda. (Se hereda de DataGridViewCell). | .gif) | ToString | Devuelve una cadena que describe el objeto actual. (Invalida a DataGridViewCell..::.ToString()()()). | Arriba

Comentarios
La clase DataGridViewImageCell es un tipo especializado de DataGridViewCell utilizado para mostrar un control Image o Icon, dependiendo del valor de la propiedad ValueIsIcon. Normalmente, la propiedad ReadOnly de DataGridViewImageCell se establece en true para indicar que el usuario no puede editar el contenido de la celda. DataGridViewImageColumn corresponde al tipo de columna especializado con el fin de contener celdas de este tipo. De manera predeterminada, la propiedad DataGridViewImageColumn..::.CellTemplate se inicializa con una nueva DataGridViewImageCell. Para modelar las celdas dentro de una columna como un control DataGridViewImageCell existente, establezca la propiedad CellTemplate de la columna en la celda para usar como modelo. Las propiedades de la columna relacionadas con celdas actúan como contenedores para las propiedades con nombres similares de la celda de plantilla. Al cambiar los valores de propiedad de la celda de plantilla sólo se verán afectadas las celdas que estén basadas en la plantilla y se hayan agregado después del cambio. Al cambiar los valores de propiedad relacionados con las celdas de la columna, sin embargo, se actualizará la celda de la plantilla y también todas las demás celdas de la columna, actualizando su presentación si es necesario. Notas para los herederosCuando derive del control DataGridViewImageCell y agregue nuevas propiedades a la clase derivada, asegúrese de reemplazar el método Clone para copiar las nuevas propiedades durante las operaciones de clonación. También debe llamar al método Clone de la clase base para que las propiedades de la clase base se copien a la nueva celda.

Ejemplos
En el ejemplo de código siguiente, se muestra cómo cambiar la imagen de una celda de la imagen con DataGridViewCell. Este ejemplo de código forma parte de un ejemplo más extenso que aparece en el tema Cómo: Trabajar con columnas de imágenes en el control DataGridView de formularios Windows Forms.
Private Sub dataGridView1_CellClick(ByVal sender As Object, _
ByVal e As DataGridViewCellEventArgs) _
Handles dataGridView1.CellClick
If turn.Text.Equals(gameOverString) Then Return
Dim cell As DataGridViewImageCell = _
CType(dataGridView1.Rows(e.RowIndex). _
Cells(e.ColumnIndex), DataGridViewImageCell)
If (cell.Value Is blank) Then
If IsOsTurn() Then
cell.Value = o
Else
cell.Value = x
End If
ToggleTurn()
ToolTip(e)
End If
If IsAWin() Then
turn.Text = gameOverString
End If
End Sub
private void dataGridView1_CellClick(object sender,
DataGridViewCellEventArgs e)
{
if (turn.Text.Equals(gameOverString)) { return; }
DataGridViewImageCell cell = (DataGridViewImageCell)
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
if (cell.Value == blank)
{
if (IsOsTurn())
{
cell.Value = o;
}
else
{
cell.Value = x;
}
ToggleTurn();
}
if (IsAWin())
{
turn.Text = gameOverString;
}
}
void dataGridView1_CellClick( Object^ sender, DataGridViewCellEventArgs^ e )
{
if ( turn->Equals( gameOverString ) )
{
return;
}
DataGridViewImageCell^ cell = dynamic_cast<DataGridViewImageCell^>(dataGridView1->Rows[ e->RowIndex ]->Cells[ e->ColumnIndex ]);
if ( cell->Value == blank )
{
if ( IsOsTurn() )
{
cell->Value = o;
}
else
{
cell->Value = x;
}
ToggleTurn();
}
if ( IsAWin( cell ) )
{
turn->Text = gameOverString;
}
}

Información de versión
.NET FrameworkCompatible con: 4, 3.5, 3.0, 2.0 .NET Framework Client ProfileCompatible con: 4, 3.5 SP1

Plataformas
Windows 7, Windows Vista SP1 o posterior, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (no se admite Server Core), Windows Server 2008 R2 (se admite Server Core con SP1 o posterior), Windows Server 2003 SP2
.NET Framework no admite todas las versiones de todas las plataformas. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

Seguridad para subprocesos
Todos los miembros static ( Shared en Visual Basic) públicos de este tipo son seguros para la ejecución de subprocesos. No se garantiza que los miembros de instancias sean seguros para la ejecución de subprocesos.

Vea también
|