Sugerir traducción
 
Otros han sugerido:

progress indicator
No hay más sugerencias.
Evaluar y enviar comentarios
Contraer todo/Expandir todo Contraer todo
Ver contenido:  en paraleloVer contenido: en paralelo
.NET Framework Class Library
DataGridViewCell Class

Represents an individual cell in a DataGridView control.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)
Visual Basic
Public MustInherit Class DataGridViewCell _
    Inherits DataGridViewElement _
    Implements ICloneable, IDisposable
C#
public abstract class DataGridViewCell : DataGridViewElement, 
    ICloneable, IDisposable
Visual C++
public ref class DataGridViewCell abstract : public DataGridViewElement, 
    ICloneable, IDisposable
F#
[<AbstractClass>]
type DataGridViewCell =  
    class
        inherit DataGridViewElement
        interface ICloneable
        interface IDisposable
    end

The DataGridViewCell type exposes the following members.

  NameDescription
Protected methodDataGridViewCellInitializes a new instance of the DataGridViewCell class.
Top
  NameDescription
Public propertyAccessibilityObjectGets the DataGridViewCell..::.DataGridViewCellAccessibleObject assigned to the DataGridViewCell.
Public propertyColumnIndexGets the column index for this cell.
Public propertyContentBoundsGets the bounding rectangle that encloses the cell's content area.
Public propertyContextMenuStripGets or sets the shortcut menu associated with the cell.
Public propertyDataGridViewGets the DataGridView control associated with this element. (Inherited from DataGridViewElement.)
Public propertyDefaultNewRowValueGets the default value for a cell in the row for new records.
Public propertyDisplayedGets a value that indicates whether the cell is currently displayed on-screen.
Public propertyEditedFormattedValueGets the current, formatted value of the cell, regardless of whether the cell is in edit mode and the value has not been committed.
Public propertyEditTypeGets the type of the cell's hosted editing control.
Public propertyErrorIconBoundsGets the bounds of the error icon for the cell.
Public propertyErrorTextGets or sets the text describing an error condition associated with the cell.
Public propertyFormattedValueGets the value of the cell as formatted for display.
Public propertyFormattedValueTypeGets the type of the formatted value associated with the cell.
Public propertyFrozenGets a value indicating whether the cell is frozen.
Public propertyHasStyleGets a value indicating whether the Style property has been set.
Public propertyInheritedStateGets the current state of the cell as inherited from the state of its row and column.
Public propertyInheritedStyleGets the style currently applied to the cell.
Public propertyIsInEditModeGets a value indicating whether this cell is currently being edited.
Public propertyOwningColumnGets the column that contains this cell.
Public propertyOwningRowGets the row that contains this cell.
Public propertyPreferredSizeGets the size, in pixels, of a rectangular area into which the cell can fit.
Public propertyReadOnlyGets or sets a value indicating whether the cell's data can be edited.
Public propertyResizableGets a value indicating whether the cell can be resized.
Public propertyRowIndexGets the index of the cell's parent row.
Public propertySelectedGets or sets a value indicating whether the cell has been selected.
Public propertySizeGets the size of the cell.
Public propertyStateGets the user interface (UI) state of the element. (Inherited from DataGridViewElement.)
Public propertyStyleGets or sets the style for the cell.
Public propertyTagGets or sets the object that contains supplemental data about the cell.
Public propertyToolTipTextGets or sets the ToolTip text associated with this cell.
Public propertyValueGets or sets the value associated with this cell.
Public propertyValueTypeGets or sets the data type of the values in the cell.
Public propertyVisibleGets a value indicating whether the cell is in a row or column that has been hidden.
Top
  NameDescription
Public methodAdjustCellBorderStyleModifies the input cell border style according to the specified criteria.
Protected methodBorderWidthsReturns a Rectangle that represents the widths of all the cell margins.
Protected methodClickUnsharesRowIndicates whether the cell's row will be unshared when the cell is clicked.
Public methodCloneCreates an exact copy of this cell.
Protected methodContentClickUnsharesRowIndicates whether the cell's row will be unshared when the cell's content is clicked.
Protected methodContentDoubleClickUnsharesRowIndicates whether the cell's row will be unshared when the cell's content is double-clicked.
Protected methodCreateAccessibilityInstanceCreates a new accessible object for the DataGridViewCell.
Public methodDetachEditingControlRemoves the cell's editing control from the DataGridView.
Public methodDispose()()()Releases all resources used by the DataGridViewCell.
Protected methodDispose(Boolean)Releases the unmanaged resources used by the DataGridViewCell and optionally releases the managed resources.
Protected methodDoubleClickUnsharesRowIndicates whether the cell's row will be unshared when the cell is double-clicked.
Protected methodEnterUnsharesRowIndicates whether the parent row will be unshared when the focus moves to the cell.
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeReleases the unmanaged resources and performs other cleanup operations before the DataGridViewCell is reclaimed by garbage collection. (Overrides Object..::.Finalize()()().)
Protected methodGetClipboardContentRetrieves the formatted value of the cell to copy to the Clipboard.
Public methodGetContentBounds(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.
Protected methodGetContentBounds(Graphics, DataGridViewCellStyle, Int32)Returns the bounding rectangle that encloses the cell's content area, which is calculated using the specified Graphics and cell style.
Public methodGetEditedFormattedValueReturns the current, formatted value of the cell, regardless of whether the cell is in edit mode and the value has not been committed.
Protected methodGetErrorIconBoundsReturns the bounding rectangle that encloses the cell's error icon, if one is displayed.
Protected methodGetErrorTextReturns a string that represents the error for the cell.
Protected methodGetFormattedValueGets the value of the cell as formatted for display.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetInheritedContextMenuStripGets the inherited shortcut menu for the current cell.
Public methodGetInheritedStateReturns a value indicating the current state of the cell as inherited from the state of its row and column.
Public methodGetInheritedStyleGets the style applied to the cell.
Protected methodGetPreferredSizeCalculates the preferred size, in pixels, of the cell.
Protected methodGetSizeGets the size of the cell.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodGetValueGets the value of the cell.
Public methodInitializeEditingControlInitializes the control used to edit the cell.
Protected methodKeyDownUnsharesRowIndicates whether the parent row is unshared if the user presses a key while the focus is on the cell.
Public methodKeyEntersEditModeDetermines if edit mode should be started based on the given key.
Protected methodKeyPressUnsharesRowIndicates whether a row will be unshared if a key is pressed while a cell in the row has focus.
Protected methodKeyUpUnsharesRowIndicates whether the parent row is unshared when the user releases a key while the focus is on the cell.
Protected methodLeaveUnsharesRowIndicates whether a row will be unshared when the focus leaves a cell in the row.
Public methodStatic memberMeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags)Gets the height, in pixels, of the specified text, given the specified characteristics.
Public methodStatic memberMeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags, Boolean%)Gets the height, in pixels, of the specified text, given the specified characteristics. Also indicates whether the required width is greater than the specified maximum width.
Public methodStatic memberMeasureTextPreferredSizeGets the ideal height and width of the specified text given the specified characteristics.
Public methodStatic memberMeasureTextSizeGets the height and width of the specified text given the specified characteristics.
Public methodStatic memberMeasureTextWidthGets the width, in pixels, of the specified text given the specified characteristics.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodMouseClickUnsharesRowIndicates whether a row will be unshared if the user clicks a mouse button while the pointer is on a cell in the row.
Protected methodMouseDoubleClickUnsharesRowIndicates whether a row will be unshared if the user double-clicks a cell in the row.
Protected methodMouseDownUnsharesRowIndicates whether a row will be unshared when the user holds down a mouse button while the pointer is on a cell in the row.
Protected methodMouseEnterUnsharesRowIndicates whether a row will be unshared when the mouse pointer moves over a cell in the row.
Protected methodMouseLeaveUnsharesRowIndicates whether a row will be unshared when the mouse pointer leaves the row.
Protected methodMouseMoveUnsharesRowIndicates whether a row will be unshared when the mouse pointer moves over a cell in the row.
Protected methodMouseUpUnsharesRowIndicates whether a row will be unshared when the user releases a mouse button while the pointer is on a cell in the row.
Protected methodOnClickCalled when the cell is clicked.
Protected methodOnContentClickCalled when the cell's contents are clicked.
Protected methodOnContentDoubleClickCalled when the cell's contents are double-clicked.
Protected methodOnDataGridViewChangedCalled when the DataGridView property of the cell changes. (Overrides DataGridViewElement..::.OnDataGridViewChanged()()().)
Protected methodOnDoubleClickCalled when the cell is double-clicked.
Protected methodOnEnterCalled when the focus moves to a cell.
Protected methodOnKeyDownCalled when a character key is pressed while the focus is on a cell.
Protected methodOnKeyPressCalled when a key is pressed while the focus is on a cell.
Protected methodOnKeyUpCalled when a character key is released while the focus is on a cell.
Protected methodOnLeaveCalled when the focus moves from a cell.
Protected methodOnMouseClickCalled when the user clicks a mouse button while the pointer is on a cell.
Protected methodOnMouseDoubleClickCalled when the user double-clicks a mouse button while the pointer is on a cell.
Protected methodOnMouseDownCalled when the user holds down a mouse button while the pointer is on a cell.
Protected methodOnMouseEnterCalled when the mouse pointer moves over a cell.
Protected methodOnMouseLeaveCalled when the mouse pointer leaves the cell.
Protected methodOnMouseMoveCalled when the mouse pointer moves within a cell.
Protected methodOnMouseUpCalled when the user releases a mouse button while the pointer is on a cell.
Protected methodPaintPaints the current DataGridViewCell.
Protected methodPaintBorderPaints the border of the current DataGridViewCell.
Protected methodPaintErrorIconPaints the error icon of the current DataGridViewCell.
Public methodParseFormattedValueConverts a value formatted for display to an actual cell value.
Public methodPositionEditingControlSets the location and size of the editing control hosted by a cell in the DataGridView control.
Public methodPositionEditingPanelSets 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.
Protected methodRaiseCellClickRaises the DataGridView..::.CellClick event. (Inherited from DataGridViewElement.)
Protected methodRaiseCellContentClickRaises the DataGridView..::.CellContentClick event. (Inherited from DataGridViewElement.)
Protected methodRaiseCellContentDoubleClickRaises the DataGridView..::.CellContentDoubleClick event. (Inherited from DataGridViewElement.)
Protected methodRaiseCellValueChangedRaises the DataGridView..::.CellValueChanged event. (Inherited from DataGridViewElement.)
Protected methodRaiseDataErrorRaises the DataGridView..::.DataError event. (Inherited from DataGridViewElement.)
Protected methodRaiseMouseWheelRaises the Control..::.MouseWheel event. (Inherited from DataGridViewElement.)
Protected methodSetValueSets the value of the cell.
Public methodToStringReturns a string that describes the current object. (Overrides Object..::.ToString()()().)
Top

The DataGridViewCell class represents an individual cell in a DataGridView control. You can retrieve cells through the Cells collection of a DataGridViewRow.

The row and column for a DataGridViewCell identify the cell's location in the DataGridView. A typical cell contains data specific to the row and column in which it is contained. The cell can be customized in a number of ways by setting its properties and handling the events associated with it.

Notes to Inheritors

When you derive from DataGridViewCell 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.

The following code example illustrates the use of this type. For more information about this example, see How to: Add ToolTips to Individual Cells in a Windows Forms DataGridView Control.

Visual Basic
' Sets the ToolTip text for cells in the Rating column.
Sub dataGridView1_CellFormatting(ByVal sender As Object, _
    ByVal e As DataGridViewCellFormattingEventArgs) _
    Handles dataGridView1.CellFormatting

    If e.ColumnIndex = Me.dataGridView1.Columns("Rating").Index _
        AndAlso (e.Value IsNot Nothing) Then

        With Me.dataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex)

            If e.Value.Equals("*") Then
                .ToolTipText = "very bad"
            ElseIf e.Value.Equals("**") Then
                .ToolTipText = "bad"
            ElseIf e.Value.Equals("***") Then
                .ToolTipText = "good"
            ElseIf e.Value.Equals("****") Then
                .ToolTipText = "very good"
            End If

        End With

    End If

End Sub 'dataGridView1_CellFormatting
C#
// Sets the ToolTip text for cells in the Rating column.
void dataGridView1_CellFormatting(object sender, 
    DataGridViewCellFormattingEventArgs e)
{
    if ( (e.ColumnIndex == this.dataGridView1.Columns["Rating"].Index)
        && e.Value != null )
    {
        DataGridViewCell cell = 
            this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
        if (e.Value.Equals("*"))
        {                
            cell.ToolTipText = "very bad";
        }
        else if (e.Value.Equals("**"))
        {
            cell.ToolTipText = "bad";
        }
        else if (e.Value.Equals("***"))
        {
            cell.ToolTipText = "good";
        }
        else if (e.Value.Equals("****"))
        {
            cell.ToolTipText = "very good";
        }
    }
}
Visual C++
// Sets the ToolTip text for cells in the Rating column.
void dataGridView1_CellFormatting(Object^ /*sender*/, 
    DataGridViewCellFormattingEventArgs^ e)
{
    if ( (e->ColumnIndex == this->dataGridView1->Columns["Rating"]->Index)
        && e->Value != nullptr )
    {
        DataGridViewCell^ cell = 
            this->dataGridView1->Rows[e->RowIndex]->Cells[e->ColumnIndex];
        if (e->Value->Equals("*"))
        {                
            cell->ToolTipText = "very bad";
        }
        else if (e->Value->Equals("**"))
        {
            cell->ToolTipText = "bad";
        }
        else if (e->Value->Equals("***"))
        {
            cell->ToolTipText = "good";
        }
        else if (e->Value->Equals("****"))
        {
            cell->ToolTipText = "very good";
        }
    }
}

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Biblioteca de clases de .NET Framework
DataGridViewCell (Clase)

Representa una celda individual de un control DataGridView.

Espacio de nombres:  System.Windows.Forms
Ensamblado:  System.Windows.Forms (en System.Windows.Forms.dll)
Visual Basic
Public MustInherit Class DataGridViewCell _
    Inherits DataGridViewElement _
    Implements ICloneable, IDisposable
C#
public abstract class DataGridViewCell : DataGridViewElement, 
    ICloneable, IDisposable
Visual C++
public ref class DataGridViewCell abstract : public DataGridViewElement, 
    ICloneable, IDisposable
F#
[<AbstractClass>]
type DataGridViewCell =  
    class
        inherit DataGridViewElement
        interface ICloneable
        interface IDisposable
    end

El tipo DataGridViewCell expone los siguientes miembros.

  NombreDescripción
Método protegidoDataGridViewCellInicializa una nueva instancia de la clase DataGridViewCell.
Arriba
  NombreDescripción
Propiedad públicaAccessibilityObjectObtiene el objeto DataGridViewCell..::.DataGridViewCellAccessibleObject asignado a DataGridViewCell.
Propiedad públicaColumnIndexObtiene el índice de columna de esta celda.
Propiedad públicaContentBoundsObtiene el rectángulo delimitador que rodea el área de contenido de la celda.
Propiedad públicaContextMenuStripObtiene o establece el menú contextual asociado a la celda.
Propiedad públicaDataGridViewObtiene el control DataGridView asociado a este elemento. (Se hereda de DataGridViewElement).
Propiedad públicaDefaultNewRowValueObtiene el valor predeterminado de una celda de la fila de nuevos registros.
Propiedad públicaDisplayedObtiene un valor que indica si la celda se muestra actualmente en pantalla.
Propiedad públicaEditedFormattedValueObtiene 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.
Propiedad públicaEditTypeObtiene el tipo del control de edición hospedado de la celda.
Propiedad públicaErrorIconBoundsObtiene los límites del icono de error para la celda.
Propiedad públicaErrorTextObtiene o establece el texto que describe una condición de error asociada a la celda.
Propiedad públicaFormattedValueObtiene el valor de la celda con el formato para mostrar.
Propiedad públicaFormattedValueTypeObtiene el tipo del valor con formato asociado a la celda.
Propiedad públicaFrozenObtiene un valor que indica si la celda está inmovilizada.
Propiedad públicaHasStyleObtiene un valor que indica si se ha establecido la propiedad Style.
Propiedad públicaInheritedStateObtiene el estado actual de la celda tal como lo hereda del estado de su fila y columna.
Propiedad públicaInheritedStyleObtiene el estilo aplicado actualmente a la celda.
Propiedad públicaIsInEditModeObtiene un valor que indica si actualmente se está editando la celda.
Propiedad públicaOwningColumnObtiene la columna que contiene esta celda.
Propiedad públicaOwningRowObtiene la fila que contiene esta celda.
Propiedad públicaPreferredSizeObtiene el tamaño, en píxeles, de un área rectangular en la que cabe la celda.
Propiedad públicaReadOnlyObtiene o establece un valor que indica si se pueden editar los datos de la celda.
Propiedad públicaResizableObtiene un valor que indica si se puede cambiar el tamaño de la celda.
Propiedad públicaRowIndexObtiene el índice de la fila primaria de la celda.
Propiedad públicaSelectedObtiene o establece un valor que indica si se ha seleccionado la celda.
Propiedad públicaSizeObtiene el tamaño de la celda.
Propiedad públicaStateObtiene el estado de la interfaz de usuario del elemento. (Se hereda de DataGridViewElement).
Propiedad públicaStyleObtiene o establece el estilo de la celda.
Propiedad públicaTagObtiene o establece el objeto que contiene datos complementarios sobre la celda.
Propiedad públicaToolTipTextObtiene o establece el texto de información sobre herramientas asociado a esta celda.
Propiedad públicaValueObtiene o establece el valor asociado a esta celda.
Propiedad públicaValueTypeObtiene o establece el tipo de datos de los valores de la celda.
Propiedad públicaVisibleObtiene un valor que indica si la celda está en una fila o columna que se ha ocultado.
Arriba
  NombreDescripción
Método públicoAdjustCellBorderStyleModifica el estilo de borde de celda de entrada según los criterios especificados.
Método protegidoBorderWidthsDevuelve un objeto Rectangle que representa el ancho de todos los márgenes de la celda.
Método protegidoClickUnsharesRowIndica si la fila de la celda dejará de estar compartida al hacer clic en la celda.
Método públicoCloneCrea una copia exacta de esta celda.
Método protegidoContentClickUnsharesRowIndica si la fila de la celda dejará de estar compartida al hacer clic en el contenido de la celda.
Método protegidoContentDoubleClickUnsharesRowIndica si la fila de la celda dejará de estar compartida al hacer doble clic en el contenido de la celda.
Método protegidoCreateAccessibilityInstanceCrea un nuevo objeto accesible para la celda DataGridViewCell.
Método públicoDetachEditingControlQuita el control de edición de la celda de DataGridView.
Método públicoDispose()()()Libera todos los recursos utilizados por el objeto DataGridViewCell.
Método protegidoDispose(Boolean)Libera los recursos no administrados que utiliza DataGridViewCell y, opcionalmente, libera los recursos administrados.
Método protegidoDoubleClickUnsharesRowIndica si la fila de la celda dejará de estar compartida al hacer doble clic en la celda.
Método protegidoEnterUnsharesRowIndica si la fila primaria va a dejar de estar compartida cuando el foco se desplace a la celda.
Método públicoEquals(Object)Determina si el objeto Object especificado es igual al objeto Object actual. (Se hereda de Object).
Método protegidoFinalizeLibera los recursos no administrados y realiza otras operaciones de limpieza antes de que el recolector de elementos no utilizados reclame DataGridViewCell. (Invalida a Object..::.Finalize()()()).
Método protegidoGetClipboardContentRecupera el valor con formato de la celda que copiar en el Clipboard.
Método públicoGetContentBounds(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.
Método protegidoGetContentBounds(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.
Método públicoGetEditedFormattedValueDevuelve 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.
Método protegidoGetErrorIconBoundsDevuelve el rectángulo delimitador que rodea el icono de error de la celda, si se muestra alguno.
Método protegidoGetErrorTextDevuelve una cadena que representa el error para la celda.
Método protegidoGetFormattedValueObtiene el valor de la celda con el formato para mostrar.
Método públicoGetHashCodeActúa como función hash para un tipo concreto. (Se hereda de Object).
Método públicoGetInheritedContextMenuStripObtiene el menú contextual heredado para la celda actual.
Método públicoGetInheritedStateDevuelve un valor que indica el estado actual de la celda tal como lo hereda del estado de su fila y columna.
Método públicoGetInheritedStyleObtiene el estilo aplicado a la celda.
Método protegidoGetPreferredSizeCalcula el tamaño preferido, en píxeles, de la celda.
Método protegidoGetSizeObtiene el tamaño de la celda.
Método públicoGetTypeObtiene el objeto Type de la instancia actual. (Se hereda de Object).
Método protegidoGetValueObtiene el valor de la celda.
Método públicoInitializeEditingControlInicializa el control utilizado para editar la celda.
Método protegidoKeyDownUnsharesRowIndica si la fila primaria deja de estar compartida cuando el usuario presiona una tecla mientras el foco está en la celda.
Método públicoKeyEntersEditModeDetermina si el modo de edición se debe iniciar basándose en la clave dada.
Método protegidoKeyPressUnsharesRowIndica si una fila va a dejar de estar compartida cuando se presiona una tecla mientras el foco está en una celda de la fila.
Método protegidoKeyUpUnsharesRowIndica si la fila primaria deja de estar compartida cuando el usuario libera una tecla mientras el foco está en la celda.
Método protegidoLeaveUnsharesRowIndica si una fila va a dejar de estar compartida cuando el foco abandone una celda de la fila.
Método públicoMiembro estáticoMeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags)Obtiene el alto, en píxeles, del texto especificado en función de las características que se indiquen.
Método públicoMiembro estáticoMeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags, Boolean%)Obtiene el alto, en píxeles, del texto especificado en función de las características que se indiquen. También indica si el ancho necesario es mayor que el ancho máximo especificado.
Método públicoMiembro estáticoMeasureTextPreferredSizeObtiene el alto y ancho ideales del texto especificado en función de las características que se indiquen.
Método públicoMiembro estáticoMeasureTextSizeObtiene el alto y ancho del texto especificado en función de las características que se indiquen.
Método públicoMiembro estáticoMeasureTextWidthObtiene el ancho, en píxeles, del texto especificado en función de las características que se indiquen.
Método protegidoMemberwiseCloneCrea una copia superficial del objeto Object actual. (Se hereda de Object).
Método protegidoMouseClickUnsharesRowIndica 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.
Método protegidoMouseDoubleClickUnsharesRowIndica si una fila va a dejar de estar compartida cuando el usuario haga doble clic en una celda de la fila.
Método protegidoMouseDownUnsharesRowIndica 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.
Método protegidoMouseEnterUnsharesRowIndica si una fila va a dejar de estar compartida cuando el puntero del mouse se sitúe sobre una celda de la fila.
Método protegidoMouseLeaveUnsharesRowIndica si una fila va a dejar de estar compartida cuando el puntero del mouse salga de la fila.
Método protegidoMouseMoveUnsharesRowIndica si una fila va a dejar de estar compartida cuando el puntero del mouse se sitúe sobre una celda de la fila.
Método protegidoMouseUpUnsharesRowIndica 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.
Método protegidoOnClickSe le llama al hacer clic en la celda.
Método protegidoOnContentClickSe le llama al hacer clic en el contenido de la celda.
Método protegidoOnContentDoubleClickSe le llama al hacer doble clic en el contenido de la celda.
Método protegidoOnDataGridViewChangedSe le llama cuando cambia la propiedad DataGridView de la celda. (Invalida a DataGridViewElement..::.OnDataGridViewChanged()()()).
Método protegidoOnDoubleClickSe le llama al hacer doble clic en la celda.
Método protegidoOnEnterSe le llama cuando el foco se desplaza a una celda.
Método protegidoOnKeyDownSe le llama cuando se presiona una tecla de carácter mientras el foco está en una celda.
Método protegidoOnKeyPressSe le llama cuando se presiona una tecla mientras el foco está en una celda.
Método protegidoOnKeyUpSe le llama cuando se suelta una tecla de carácter mientras el foco está en una celda.
Método protegidoOnLeaveSe le llama cuando el foco se desplaza de una celda.
Método protegidoOnMouseClickSe le llama cuando el usuario hace clic en un botón del mouse mientras el puntero está en una celda.
Método protegidoOnMouseDoubleClickSe le llama cuando el usuario hace clic en un botón del mouse mientras el puntero está en una celda.
Método protegidoOnMouseDownSe le llama cuando el usuario mantiene presionado un botón del mouse mientras el puntero está en una celda.
Método protegidoOnMouseEnterSe le llama cuando el puntero del mouse se mueve sobre una celda.
Método protegidoOnMouseLeaveSe le llama cuando el puntero del mouse sale de la celda.
Método protegidoOnMouseMoveSe le llama cuando el puntero del mouse se mueve dentro de una celda.
Método protegidoOnMouseUpSe le llama cuando el usuario suelta un botón del mouse mientras el puntero está en una celda.
Método protegidoPaintDibuja la celda DataGridViewCell actual.
Método protegidoPaintBorderDibuja el borde del control DataGridViewCell actual.
Método protegidoPaintErrorIconDibuja el icono de error del control DataGridViewCell actual.
Método públicoParseFormattedValueConvierte un valor con formato de presentación en un valor de celda real.
Método públicoPositionEditingControlEstablece la ubicación y tamaño del control de edición que hospeda una celda del control DataGridView.
Método públicoPositionEditingPanelEstablece 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.
Método protegidoRaiseCellClickProvoca el evento DataGridView..::.CellClick. (Se hereda de DataGridViewElement).
Método protegidoRaiseCellContentClickGenera el evento DataGridView..::.CellContentClick. (Se hereda de DataGridViewElement).
Método protegidoRaiseCellContentDoubleClickGenera el evento DataGridView..::.CellContentDoubleClick. (Se hereda de DataGridViewElement).
Método protegidoRaiseCellValueChangedGenera el evento DataGridView..::.CellValueChanged. (Se hereda de DataGridViewElement).
Método protegidoRaiseDataErrorGenera el evento DataGridView..::.DataError. (Se hereda de DataGridViewElement).
Método protegidoRaiseMouseWheelProvoca el evento Control..::.MouseWheel. (Se hereda de DataGridViewElement).
Método protegidoSetValueEstablece el valor de la celda.
Método públicoToStringDevuelve una cadena que describe el objeto actual. (Invalida a Object..::.ToString()()()).
Arriba

La clase DataGridViewCell representa una celda individual de un control DataGridView. Puede recuperar celdas mediante la colección Cells de un DataGridViewRow.

La fila y la columna de DataGridViewCell identifican la ubicación de la celda en el control DataGridView. Una celda normal contiene los datos específicos de la fila y la columna que la contienen. La celda se puede personalizar de varias maneras estableciendo sus propiedades y controlando los eventos asociados a ella.

Notas para los herederos

Cuando derive de DataGridViewCell 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 en la nueva celda.

En el ejemplo de código siguiente se muestra el uso de este tipo. Para obtener más información sobre este elemento, vea Cómo: Agregar información sobre herramientas a celdas individuales en un control DataGridView de formularios Windows Forms.

Visual Basic
' Sets the ToolTip text for cells in the Rating column.
Sub dataGridView1_CellFormatting(ByVal sender As Object, _
    ByVal e As DataGridViewCellFormattingEventArgs) _
    Handles dataGridView1.CellFormatting

    If e.ColumnIndex = Me.dataGridView1.Columns("Rating").Index _
        AndAlso (e.Value IsNot Nothing) Then

        With Me.dataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex)

            If e.Value.Equals("*") Then
                .ToolTipText = "very bad"
            ElseIf e.Value.Equals("**") Then
                .ToolTipText = "bad"
            ElseIf e.Value.Equals("***") Then
                .ToolTipText = "good"
            ElseIf e.Value.Equals("****") Then
                .ToolTipText = "very good"
            End If

        End With

    End If

End Sub 'dataGridView1_CellFormatting
C#
// Sets the ToolTip text for cells in the Rating column.
void dataGridView1_CellFormatting(object sender, 
    DataGridViewCellFormattingEventArgs e)
{
    if ( (e.ColumnIndex == this.dataGridView1.Columns["Rating"].Index)
        && e.Value != null )
    {
        DataGridViewCell cell = 
            this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
        if (e.Value.Equals("*"))
        {                
            cell.ToolTipText = "very bad";
        }
        else if (e.Value.Equals("**"))
        {
            cell.ToolTipText = "bad";
        }
        else if (e.Value.Equals("***"))
        {
            cell.ToolTipText = "good";
        }
        else if (e.Value.Equals("****"))
        {
            cell.ToolTipText = "very good";
        }
    }
}
Visual C++
// Sets the ToolTip text for cells in the Rating column.
void dataGridView1_CellFormatting(Object^ /*sender*/, 
    DataGridViewCellFormattingEventArgs^ e)
{
    if ( (e->ColumnIndex == this->dataGridView1->Columns["Rating"]->Index)
        && e->Value != nullptr )
    {
        DataGridViewCell^ cell = 
            this->dataGridView1->Rows[e->RowIndex]->Cells[e->ColumnIndex];
        if (e->Value->Equals("*"))
        {                
            cell->ToolTipText = "very bad";
        }
        else if (e->Value->Equals("**"))
        {
            cell->ToolTipText = "bad";
        }
        else if (e->Value->Equals("***"))
        {
            cell->ToolTipText = "good";
        }
        else if (e->Value->Equals("****"))
        {
            cell->ToolTipText = "very good";
        }
    }
}

.NET Framework

Compatible con: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Compatible con: 4, 3.5 SP1

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.
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.
Contenido de la comunidad   ¿Qué es Community Content?
Agregar contenido nuevo RSS  Anotaciones
Processing
© 2012 Microsoft. Reservados todos los derechos. Términos de uso | Marcas Registradas | Privacidad
Page view tracker