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
DataGridViewCheckBoxCell Class

Displays a check box user interface (UI) to use in a DataGridView control.

System..::.Object
  System.Windows.Forms..::.DataGridViewElement
    System.Windows.Forms..::.DataGridViewCell
      System.Windows.Forms..::.DataGridViewCheckBoxCell

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)
Visual Basic
Public Class DataGridViewCheckBoxCell _
    Inherits DataGridViewCell _
    Implements IDataGridViewEditingCell
C#
public class DataGridViewCheckBoxCell : DataGridViewCell, 
    IDataGridViewEditingCell
Visual C++
public ref class DataGridViewCheckBoxCell : public DataGridViewCell, 
    IDataGridViewEditingCell
F#
type DataGridViewCheckBoxCell =  
    class
        inherit DataGridViewCell
        interface IDataGridViewEditingCell
    end

The DataGridViewCheckBoxCell type exposes the following members.

  NameDescription
Public methodDataGridViewCheckBoxCell()()()Initializes a new instance of the DataGridViewCheckBoxCell class to its default state.
Public methodDataGridViewCheckBoxCell(Boolean)Initializes a new instance of the DataGridViewCheckBoxCell class, enabling binary or ternary state.
Top
  NameDescription
Public propertyAccessibilityObjectGets the DataGridViewCell..::.DataGridViewCellAccessibleObject assigned to the DataGridViewCell. (Inherited from DataGridViewCell.)
Public propertyColumnIndexGets the column index for this cell. (Inherited from DataGridViewCell.)
Public propertyContentBoundsGets the bounding rectangle that encloses the cell's content area. (Inherited from DataGridViewCell.)
Public propertyContextMenuStripGets or sets the shortcut menu associated with the cell. (Inherited from DataGridViewCell.)
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. (Inherited from DataGridViewCell.)
Public propertyDisplayedGets a value that indicates whether the cell is currently displayed on-screen. (Inherited from DataGridViewCell.)
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. (Inherited from DataGridViewCell.)
Public propertyEditingCellFormattedValueGets or sets the formatted value of the control hosted by the cell when it is in edit mode.
Public propertyEditingCellValueChangedGets or sets a flag indicating that the value has been changed for this cell.
Public propertyEditTypeGets the type of the cell's hosted editing control. (Overrides DataGridViewCell..::.EditType.)
Public propertyErrorIconBoundsGets the bounds of the error icon for the cell. (Inherited from DataGridViewCell.)
Public propertyErrorTextGets or sets the text describing an error condition associated with the cell. (Inherited from DataGridViewCell.)
Public propertyFalseValueGets or sets the underlying value corresponding to a cell value of false.
Public propertyFlatStyleGets or sets the flat style appearance of the check box user interface (UI).
Public propertyFormattedValueGets the value of the cell as formatted for display. (Inherited from DataGridViewCell.)
Public propertyFormattedValueTypeGets the type of the cell display value. (Overrides DataGridViewCell..::.FormattedValueType.)
Public propertyFrozenGets a value indicating whether the cell is frozen. (Inherited from DataGridViewCell.)
Public propertyHasStyleGets a value indicating whether the Style property has been set. (Inherited from DataGridViewCell.)
Public propertyIndeterminateValueGets or sets the underlying value corresponding to an indeterminate or nullNothingnullptra null reference (Nothing in Visual Basic) cell value.
Public propertyInheritedStateGets the current state of the cell as inherited from the state of its row and column. (Inherited from DataGridViewCell.)
Public propertyInheritedStyleGets the style currently applied to the cell. (Inherited from DataGridViewCell.)
Public propertyIsInEditModeGets a value indicating whether this cell is currently being edited. (Inherited from DataGridViewCell.)
Public propertyOwningColumnGets the column that contains this cell. (Inherited from DataGridViewCell.)
Public propertyOwningRowGets the row that contains this cell. (Inherited from DataGridViewCell.)
Public propertyPreferredSizeGets the size, in pixels, of a rectangular area into which the cell can fit. (Inherited from DataGridViewCell.)
Public propertyReadOnlyGets or sets a value indicating whether the cell's data can be edited. (Inherited from DataGridViewCell.)
Public propertyResizableGets a value indicating whether the cell can be resized. (Inherited from DataGridViewCell.)
Public propertyRowIndexGets the index of the cell's parent row. (Inherited from DataGridViewCell.)
Public propertySelectedGets or sets a value indicating whether the cell has been selected. (Inherited from DataGridViewCell.)
Public propertySizeGets the size of the cell. (Inherited from DataGridViewCell.)
Public propertyStateGets the user interface (UI) state of the element. (Inherited from DataGridViewElement.)
Public propertyStyleGets or sets the style for the cell. (Inherited from DataGridViewCell.)
Public propertyTagGets or sets the object that contains supplemental data about the cell. (Inherited from DataGridViewCell.)
Public propertyThreeStateGets or sets a value indicating whether ternary mode has been enabled for the hosted check box control.
Public propertyToolTipTextGets or sets the ToolTip text associated with this cell. (Inherited from DataGridViewCell.)
Public propertyTrueValueGets or sets the underlying value corresponding to a cell value of true.
Public propertyValueGets or sets the value associated with this cell. (Inherited from DataGridViewCell.)
Public propertyValueTypeGets the data type of the values in the cell. (Overrides DataGridViewCell..::.ValueType.)
Public propertyVisibleGets a value indicating whether the cell is in a row or column that has been hidden. (Inherited from DataGridViewCell.)
Top
  NameDescription
Public methodAdjustCellBorderStyleModifies the input cell border style according to the specified criteria. (Inherited from DataGridViewCell.)
Protected methodBorderWidthsReturns a Rectangle that represents the widths of all the cell margins. (Inherited from DataGridViewCell.)
Protected methodClickUnsharesRowIndicates whether the cell's row will be unshared when the cell is clicked. (Inherited from DataGridViewCell.)
Public methodCloneCreates an exact copy of this cell. (Overrides DataGridViewCell..::.Clone()()().)
Protected methodContentClickUnsharesRowIndicates whether the row containing the cell will be unshared when the cell content is clicked. (Overrides DataGridViewCell..::.ContentClickUnsharesRow(DataGridViewCellEventArgs).)
Protected methodContentDoubleClickUnsharesRowIndicates whether the row containing the cell will be unshared when the cell content is double-clicked. (Overrides DataGridViewCell..::.ContentDoubleClickUnsharesRow(DataGridViewCellEventArgs).)
Protected methodCreateAccessibilityInstanceCreates a new accessible object for the DataGridViewCheckBoxCell. (Overrides DataGridViewCell..::.CreateAccessibilityInstance()()().)
Public methodDetachEditingControlRemoves the cell's editing control from the DataGridView. (Inherited from DataGridViewCell.)
Public methodDispose()()()Releases all resources used by the DataGridViewCell. (Inherited from DataGridViewCell.)
Protected methodDispose(Boolean)Releases the unmanaged resources used by the DataGridViewCell and optionally releases the managed resources. (Inherited from DataGridViewCell.)
Protected methodDoubleClickUnsharesRowIndicates whether the cell's row will be unshared when the cell is double-clicked. (Inherited from DataGridViewCell.)
Protected methodEnterUnsharesRowIndicates whether the parent row will be unshared when the focus moves to the cell. (Inherited from DataGridViewCell.)
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. (Inherited from DataGridViewCell.)
Protected methodGetClipboardContentRetrieves the formatted value of the cell to copy to the Clipboard. (Inherited from DataGridViewCell.)
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. (Inherited from DataGridViewCell.)
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. (Overrides DataGridViewCell..::.GetContentBounds(Graphics, DataGridViewCellStyle, Int32).)
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. (Inherited from DataGridViewCell.)
Public methodGetEditingCellFormattedValueGets the formatted value of the cell while it is in edit mode.
Protected methodGetErrorIconBoundsReturns the bounding rectangle that encloses the cell's error icon, if one is displayed. (Overrides DataGridViewCell..::.GetErrorIconBounds(Graphics, DataGridViewCellStyle, Int32).)
Protected methodGetErrorTextReturns a string that represents the error for the cell. (Inherited from DataGridViewCell.)
Protected methodGetFormattedValueGets the formatted value of the cell's data. (Overrides DataGridViewCell..::.GetFormattedValue(Object, Int32, DataGridViewCellStyle%, TypeConverter, TypeConverter, DataGridViewDataErrorContexts).)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetInheritedContextMenuStripGets the inherited shortcut menu for the current cell. (Inherited from DataGridViewCell.)
Public methodGetInheritedStateReturns a value indicating the current state of the cell as inherited from the state of its row and column. (Inherited from DataGridViewCell.)
Public methodGetInheritedStyleGets the style applied to the cell. (Inherited from DataGridViewCell.)
Protected methodGetPreferredSizeCalculates the preferred size, in pixels, of the cell. (Overrides DataGridViewCell..::.GetPreferredSize(Graphics, DataGridViewCellStyle, Int32, Size).)
Protected methodGetSizeGets the size of the cell. (Inherited from DataGridViewCell.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodGetValueGets the value of the cell. (Inherited from DataGridViewCell.)
Public methodInitializeEditingControlInitializes the control used to edit the cell. (Inherited from DataGridViewCell.)
Protected methodKeyDownUnsharesRowIndicates whether the row containing the cell is unshared when a key is pressed while the cell has focus. (Overrides DataGridViewCell..::.KeyDownUnsharesRow(KeyEventArgs, Int32).)
Public methodKeyEntersEditModeDetermines if edit mode should be started based on the given key. (Inherited from DataGridViewCell.)
Protected methodKeyPressUnsharesRowIndicates whether a row will be unshared if a key is pressed while a cell in the row has focus. (Inherited from DataGridViewCell.)
Protected methodKeyUpUnsharesRowIndicates whether the row containing the cell is unshared when a key is released while the cell has focus. (Overrides DataGridViewCell..::.KeyUpUnsharesRow(KeyEventArgs, Int32).)
Protected methodLeaveUnsharesRowIndicates whether a row will be unshared when the focus leaves a cell in the row. (Inherited from DataGridViewCell.)
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. (Inherited from DataGridViewCell.)
Protected methodMouseDoubleClickUnsharesRowIndicates whether a row will be unshared if the user double-clicks a cell in the row. (Inherited from DataGridViewCell.)
Protected methodMouseDownUnsharesRowIndicates whether the row containing the cell will be unshared when the mouse button is pressed while the pointer is over the cell. (Overrides DataGridViewCell..::.MouseDownUnsharesRow(DataGridViewCellMouseEventArgs).)
Protected methodMouseEnterUnsharesRowIndicates whether the row containing the cell will be unshared when the mouse pointer moves over the cell. (Overrides DataGridViewCell..::.MouseEnterUnsharesRow(Int32).)
Protected methodMouseLeaveUnsharesRowIndicates whether the row containing the cell will be unshared when the mouse pointer leaves the cell. (Overrides DataGridViewCell..::.MouseLeaveUnsharesRow(Int32).)
Protected methodMouseMoveUnsharesRowIndicates whether a row will be unshared when the mouse pointer moves over a cell in the row. (Inherited from DataGridViewCell.)
Protected methodMouseUpUnsharesRowIndicates whether the row containing the cell will be unshared when the mouse button is released while the pointer is over the cell. (Overrides DataGridViewCell..::.MouseUpUnsharesRow(DataGridViewCellMouseEventArgs).)
Protected methodOnClickCalled when the cell is clicked. (Inherited from DataGridViewCell.)
Protected methodOnContentClickCalled when the cell's contents are clicked. (Overrides DataGridViewCell..::.OnContentClick(DataGridViewCellEventArgs).)
Protected methodOnContentDoubleClickCalled when the cell's contents are double-clicked. (Overrides DataGridViewCell..::.OnContentDoubleClick(DataGridViewCellEventArgs).)
Protected methodOnDataGridViewChangedCalled when the DataGridView property of the cell changes. (Inherited from DataGridViewCell.)
Protected methodOnDoubleClickCalled when the cell is double-clicked. (Inherited from DataGridViewCell.)
Protected methodOnEnterCalled when the focus moves to a cell. (Inherited from DataGridViewCell.)
Protected methodOnKeyDownCalled when a character key is pressed while the focus is on a cell. (Overrides DataGridViewCell..::.OnKeyDown(KeyEventArgs, Int32).)
Protected methodOnKeyPressCalled when a key is pressed while the focus is on a cell. (Inherited from DataGridViewCell.)
Protected methodOnKeyUpCalled when a character key is released while the focus is on a cell. (Overrides DataGridViewCell..::.OnKeyUp(KeyEventArgs, Int32).)
Protected methodOnLeaveCalled when the focus moves from a cell. (Overrides DataGridViewCell..::.OnLeave(Int32, Boolean).)
Protected methodOnMouseClickCalled when the user clicks a mouse button while the pointer is on a cell. (Inherited from DataGridViewCell.)
Protected methodOnMouseDoubleClickCalled when the user double-clicks a mouse button while the pointer is on a cell. (Inherited from DataGridViewCell.)
Protected methodOnMouseDownCalled when the mouse button is held down while the pointer is on a cell. (Overrides DataGridViewCell..::.OnMouseDown(DataGridViewCellMouseEventArgs).)
Protected methodOnMouseEnterCalled when the mouse pointer moves over a cell. (Inherited from DataGridViewCell.)
Protected methodOnMouseLeaveCalled when the mouse pointer moves from a cell. (Overrides DataGridViewCell..::.OnMouseLeave(Int32).)
Protected methodOnMouseMoveCalled when the mouse pointer moves within a cell. (Overrides DataGridViewCell..::.OnMouseMove(DataGridViewCellMouseEventArgs).)
Protected methodOnMouseUpCalled when the mouse button is released while the pointer is on a cell. (Overrides DataGridViewCell..::.OnMouseUp(DataGridViewCellMouseEventArgs).)
Protected methodPaintPaints the current DataGridViewCheckBoxCell. (Overrides DataGridViewCell..::.Paint(Graphics, Rectangle, Rectangle, Int32, DataGridViewElementStates, Object, Object, String, DataGridViewCellStyle, DataGridViewAdvancedBorderStyle, DataGridViewPaintParts).)
Protected methodPaintBorderPaints the border of the current DataGridViewCell. (Inherited from DataGridViewCell.)
Protected methodPaintErrorIconPaints the error icon of the current DataGridViewCell. (Inherited from DataGridViewCell.)
Public methodParseFormattedValueConverts a value formatted for display to an actual cell value. (Overrides DataGridViewCell..::.ParseFormattedValue(Object, DataGridViewCellStyle, TypeConverter, TypeConverter).)
Public methodPositionEditingControlSets the location and size of the editing control hosted by a cell in the DataGridView control. (Inherited from DataGridViewCell.)
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. (Inherited from DataGridViewCell.)
Public methodPrepareEditingCellForEditThis method is not meaningful for this type.
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. (Inherited from DataGridViewCell.)
Public methodToStringReturns the string representation of the cell. (Overrides DataGridViewCell..::.ToString()()().)
Top

The DataGridViewCheckBoxCell class is a specialized type of DataGridViewCell used to display binary or ternary information presented through a check box UI. In the default binary mode, the cells can hold values of true or false. In ternary mode, the cells take on one of the CheckState values. The ThreeState property determines whether binary or ternary mode is in effect.

The DataGridViewCheckBoxColumn is the column type specialized to hold cells of this type. By default, the DataGridViewCheckBoxColumn..::.CellTemplate is initialized to a new DataGridViewCheckBoxCell. To pattern the cells within a column after an existing DataGridViewCheckBoxCell, 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.

When the current cell is a DataGridViewCheckBoxCell, the DataGridView..::.IsCurrentCellInEditMode property is always true.

Typically, check box cell values are intended either for storage, like any other data, or for performing bulk operations. If you want to respond immediately when users click a check box cell, you can handle the DataGridView..::.CellClick event, but this event occurs before the cell value is updated. If you need the new value at the time of the click, one option is to calculate what the expected value will be based on the current value. Another approach is to commit the change immediately, and handle the DataGridView..::.CellValueChanged event to respond to it. To commit the change when the cell is clicked, you must handle the DataGridView..::.CurrentCellDirtyStateChanged event. In the handler, if the current cell is a check box cell, call the DataGridView..::.CommitEdit method and pass in the Commit value.

Notes to Inheritors

When you derive from DataGridViewCheckBoxCell 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 uses a DataGridViewCheckBoxColumn to track which employees are in the office. The column is made up of DataGridViewCheckBoxCell objects. This example is part of a larger example available in the DataGridViewComboBoxColumn class overview topic.

Visual Basic
Private Sub AddOutOfOfficeColumn()
    Dim column As New DataGridViewCheckBoxColumn()
    With column
        .HeaderText = ColumnName.OutOfOffice.ToString()
        .Name = ColumnName.OutOfOffice.ToString()
        .AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells
        .FlatStyle = FlatStyle.Standard
        .CellTemplate = New DataGridViewCheckBoxCell()
        .CellTemplate.Style.BackColor = Color.Beige
    End With

    DataGridView1.Columns.Insert(0, column)
End Sub
C#
private void AddOutOfOfficeColumn()
{
    DataGridViewCheckBoxColumn column = new DataGridViewCheckBoxColumn();
    {
        column.HeaderText = ColumnName.OutOfOffice.ToString();
        column.Name = ColumnName.OutOfOffice.ToString();
        column.AutoSizeMode = 
            DataGridViewAutoSizeColumnMode.DisplayedCells;
        column.FlatStyle = FlatStyle.Standard;
        column.ThreeState = true;
        column.CellTemplate = new DataGridViewCheckBoxCell();
        column.CellTemplate.Style.BackColor = Color.Beige;
    }

    DataGridView1.Columns.Insert(0, column);
}
Visual C++
private:
    void AddOutOfOfficeColumn()
    {
        DataGridViewCheckBoxColumn^ column = gcnew DataGridViewCheckBoxColumn();
        {
            column->HeaderText = ColumnName::OutOfOffice.ToString();
            column->Name = ColumnName::OutOfOffice.ToString();
            column->AutoSizeMode = 
                DataGridViewAutoSizeColumnMode::DisplayedCells;
            column->FlatStyle = FlatStyle::Standard;
            column->ThreeState = true;
            column->CellTemplate = gcnew DataGridViewCheckBoxCell();
            column->CellTemplate->Style->BackColor = Color::Beige;
        }

        DataGridView1->Columns->Insert(0, column);
    }

.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
DataGridViewCheckBoxCell (Clase)

Muestra una interfaz de usuario con apariencia de casilla para su uso en un control DataGridView.

System..::.Object
  System.Windows.Forms..::.DataGridViewElement
    System.Windows.Forms..::.DataGridViewCell
      System.Windows.Forms..::.DataGridViewCheckBoxCell

Espacio de nombres:  System.Windows.Forms
Ensamblado:  System.Windows.Forms (en System.Windows.Forms.dll)
Visual Basic
Public Class DataGridViewCheckBoxCell _
    Inherits DataGridViewCell _
    Implements IDataGridViewEditingCell
C#
public class DataGridViewCheckBoxCell : DataGridViewCell, 
    IDataGridViewEditingCell
Visual C++
public ref class DataGridViewCheckBoxCell : public DataGridViewCell, 
    IDataGridViewEditingCell
F#
type DataGridViewCheckBoxCell =  
    class
        inherit DataGridViewCell
        interface IDataGridViewEditingCell
    end

El tipo DataGridViewCheckBoxCell expone los siguientes miembros.

  NombreDescripción
Método públicoDataGridViewCheckBoxCell()()()Inicializa una nueva instancia de la clase DataGridViewCheckBoxCell en su estado predeterminado.
Método públicoDataGridViewCheckBoxCell(Boolean)Inicializa una nueva instancia de la clase DataGridViewCheckBoxCell, habilitando el estado binario o ternario.
Arriba
  NombreDescripción
Propiedad públicaAccessibilityObjectObtiene el objeto DataGridViewCell..::.DataGridViewCellAccessibleObject asignado a DataGridViewCell. (Se hereda de DataGridViewCell).
Propiedad públicaColumnIndexObtiene el índice de columna de esta celda. (Se hereda de DataGridViewCell).
Propiedad públicaContentBoundsObtiene el rectángulo delimitador que rodea el área de contenido de la celda. (Se hereda de DataGridViewCell).
Propiedad públicaContextMenuStripObtiene o establece el menú contextual asociado a la celda. (Se hereda de DataGridViewCell).
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. (Se hereda de DataGridViewCell).
Propiedad públicaDisplayedObtiene un valor que indica si la celda se muestra actualmente en pantalla. (Se hereda de DataGridViewCell).
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. (Se hereda de DataGridViewCell).
Propiedad públicaEditingCellFormattedValueObtiene o establece el valor con formato del control hospedado por la celda cuando está en modo de edición.
Propiedad públicaEditingCellValueChangedObtiene o establece un marcador de que el valor de esta celda ha cambiado.
Propiedad públicaEditTypeObtiene el tipo del control de edición hospedado de la celda. (Invalida a DataGridViewCell..::.EditType).
Propiedad públicaErrorIconBoundsObtiene los límites del icono de error para la celda. (Se hereda de DataGridViewCell).
Propiedad públicaErrorTextObtiene o establece el texto que describe una condición de error asociada a la celda. (Se hereda de DataGridViewCell).
Propiedad públicaFalseValueObtiene o establece el valor subyacente que corresponde a un valor de celda de false.
Propiedad públicaFlatStyleObtiene o establece la apariencia de estilo plano de la interfaz de usuario de casilla.
Propiedad públicaFormattedValueObtiene el valor de la celda con el formato para mostrar. (Se hereda de DataGridViewCell).
Propiedad públicaFormattedValueTypeObtiene el tipo del valor de presentación de la celda. (Invalida a DataGridViewCell..::.FormattedValueType).
Propiedad públicaFrozenObtiene un valor que indica si la celda está inmovilizada. (Se hereda de DataGridViewCell).
Propiedad públicaHasStyleObtiene un valor que indica si se ha establecido la propiedad Style. (Se hereda de DataGridViewCell).
Propiedad públicaIndeterminateValueObtiene o establece el valor subyacente que corresponde a un valor de celda indeterminado o nullNothingnullptrreferencia null (Nothing en Visual Basic).
Propiedad públicaInheritedStateObtiene el estado actual de la celda tal como lo hereda del estado de su fila y columna. (Se hereda de DataGridViewCell).
Propiedad públicaInheritedStyleObtiene el estilo aplicado actualmente a la celda. (Se hereda de DataGridViewCell).
Propiedad públicaIsInEditModeObtiene un valor que indica si actualmente se está editando la celda. (Se hereda de DataGridViewCell).
Propiedad públicaOwningColumnObtiene la columna que contiene esta celda. (Se hereda de DataGridViewCell).
Propiedad públicaOwningRowObtiene la fila que contiene esta celda. (Se hereda de DataGridViewCell).
Propiedad públicaPreferredSizeObtiene el tamaño, en píxeles, de un área rectangular en la que cabe la celda. (Se hereda de DataGridViewCell).
Propiedad públicaReadOnlyObtiene o establece un valor que indica si se pueden editar los datos de la celda. (Se hereda de DataGridViewCell).
Propiedad públicaResizableObtiene un valor que indica si se puede cambiar el tamaño de la celda. (Se hereda de DataGridViewCell).
Propiedad públicaRowIndexObtiene el índice de la fila primaria de la celda. (Se hereda de DataGridViewCell).
Propiedad públicaSelectedObtiene o establece un valor que indica si se ha seleccionado la celda. (Se hereda de DataGridViewCell).
Propiedad públicaSizeObtiene el tamaño de la celda. (Se hereda de DataGridViewCell).
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. (Se hereda de DataGridViewCell).
Propiedad públicaTagObtiene o establece el objeto que contiene datos complementarios sobre la celda. (Se hereda de DataGridViewCell).
Propiedad públicaThreeStateObtiene o establece un valor que indica si el modo ternario se ha habilitado para el control de casilla hospedado.
Propiedad públicaToolTipTextObtiene o establece el texto de información sobre herramientas asociado a esta celda. (Se hereda de DataGridViewCell).
Propiedad públicaTrueValueObtiene o establece el valor subyacente que corresponde a un valor de celda de true.
Propiedad públicaValueObtiene o establece el valor asociado a esta celda. (Se hereda de DataGridViewCell).
Propiedad públicaValueTypeObtiene el tipo de datos de los valores de la celda. (Invalida a DataGridViewCell..::.ValueType).
Propiedad públicaVisibleObtiene un valor que indica si la celda está en una fila o columna que se ha ocultado. (Se hereda de DataGridViewCell).
Arriba
  NombreDescripción
Método públicoAdjustCellBorderStyleModifica el estilo de borde de celda de entrada según los criterios especificados. (Se hereda de DataGridViewCell).
Método protegidoBorderWidthsDevuelve un objeto Rectangle que representa el ancho de todos los márgenes de la celda. (Se hereda de DataGridViewCell).
Método protegidoClickUnsharesRowIndica si la fila de la celda dejará de estar compartida al hacer clic en la celda. (Se hereda de DataGridViewCell).
Método públicoCloneCrea una copia exacta de esta celda. (Invalida a DataGridViewCell..::.Clone()()()).
Método protegidoContentClickUnsharesRowIndica si dejará de compartirse la fila que contiene la celda cuando se haga clic en el contenido de la celda. (Invalida a DataGridViewCell..::.ContentClickUnsharesRow(DataGridViewCellEventArgs)).
Método protegidoContentDoubleClickUnsharesRowIndica si dejará de compartirse la fila que contiene la celda cuando se haga doble clic en el contenido de la celda. (Invalida a DataGridViewCell..::.ContentDoubleClickUnsharesRow(DataGridViewCellEventArgs)).
Método protegidoCreateAccessibilityInstanceCrea un nuevo objeto accesible para el control DataGridViewCheckBoxCell. (Invalida a DataGridViewCell..::.CreateAccessibilityInstance()()()).
Método públicoDetachEditingControlQuita el control de edición de la celda de DataGridView. (Se hereda de DataGridViewCell).
Método públicoDispose()()()Libera todos los recursos utilizados por el objeto DataGridViewCell. (Se hereda de DataGridViewCell).
Método protegidoDispose(Boolean)Libera los recursos no administrados que utiliza DataGridViewCell y, opcionalmente, libera los recursos administrados. (Se hereda de DataGridViewCell).
Método protegidoDoubleClickUnsharesRowIndica si la fila de la celda dejará de estar compartida al hacer doble clic en la celda. (Se hereda de DataGridViewCell).
Método protegidoEnterUnsharesRowIndica si la fila primaria va a dejar de estar compartida cuando el foco se desplace a la celda. (Se hereda de DataGridViewCell).
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. (Se hereda de DataGridViewCell).
Método protegidoGetClipboardContentRecupera el valor con formato de la celda que copiar en el Clipboard. (Se hereda de DataGridViewCell).
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. (Se hereda de DataGridViewCell).
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. (Invalida a DataGridViewCell..::.GetContentBounds(Graphics, DataGridViewCellStyle, Int32)).
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. (Se hereda de DataGridViewCell).
Método públicoGetEditingCellFormattedValueObtiene el valor con formato de la celda mientras está en modo de edición.
Método protegidoGetErrorIconBoundsDevuelve el rectángulo delimitador que rodea el icono de error de la celda, si se muestra alguno. (Invalida a DataGridViewCell..::.GetErrorIconBounds(Graphics, DataGridViewCellStyle, Int32)).
Método protegidoGetErrorTextDevuelve una cadena que representa el error para la celda. (Se hereda de DataGridViewCell).
Método protegidoGetFormattedValueObtiene el valor con formato de los datos de la celda. (Invalida a DataGridViewCell..::.GetFormattedValue(Object, Int32, DataGridViewCellStyle%, TypeConverter, TypeConverter, DataGridViewDataErrorContexts)).
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. (Se hereda de DataGridViewCell).
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. (Se hereda de DataGridViewCell).
Método públicoGetInheritedStyleObtiene el estilo aplicado a la celda. (Se hereda de DataGridViewCell).
Método protegidoGetPreferredSizeCalcula el tamaño preferido, en píxeles, de la celda. (Invalida a DataGridViewCell..::.GetPreferredSize(Graphics, DataGridViewCellStyle, Int32, Size)).
Método protegidoGetSizeObtiene el tamaño de la celda. (Se hereda de DataGridViewCell).
Método públicoGetTypeObtiene el objeto Type de la instancia actual. (Se hereda de Object).
Método protegidoGetValueObtiene el valor de la celda. (Se hereda de DataGridViewCell).
Método públicoInitializeEditingControlInicializa el control utilizado para editar la celda. (Se hereda de DataGridViewCell).
Método protegidoKeyDownUnsharesRowIndica si se deja de compartir la fila que contiene la celda cuando se presiona una tecla mientras la celda tiene el foco. (Invalida a DataGridViewCell..::.KeyDownUnsharesRow(KeyEventArgs, Int32)).
Método públicoKeyEntersEditModeDetermina si el modo de edición se debe iniciar basándose en la clave dada. (Se hereda de DataGridViewCell).
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. (Se hereda de DataGridViewCell).
Método protegidoKeyUpUnsharesRowIndica si se deja de compartir la fila que contiene la celda cuando se suelta una tecla mientras la celda tiene el foco. (Invalida a DataGridViewCell..::.KeyUpUnsharesRow(KeyEventArgs, Int32)).
Método protegidoLeaveUnsharesRowIndica si una fila va a dejar de estar compartida cuando el foco abandone una celda de la fila. (Se hereda de DataGridViewCell).
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. (Se hereda de DataGridViewCell).
Método protegidoMouseDoubleClickUnsharesRowIndica 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).
Método protegidoMouseDownUnsharesRowIndica si se dejará de compartir la fila que contiene la celda cuando se presiona el botón del mouse mientras el puntero está sobre la celda. (Invalida a DataGridViewCell..::.MouseDownUnsharesRow(DataGridViewCellMouseEventArgs)).
Método protegidoMouseEnterUnsharesRowIndica si dejará de compartirse la fila que contiene la celda cuando el puntero del mouse se mueva sobre la celda. (Invalida a DataGridViewCell..::.MouseEnterUnsharesRow(Int32)).
Método protegidoMouseLeaveUnsharesRowIndica si dejará de compartirse la fila que contiene la celda cuando el puntero del mouse salga de la celda. (Invalida a DataGridViewCell..::.MouseLeaveUnsharesRow(Int32)).
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. (Se hereda de DataGridViewCell).
Método protegidoMouseUpUnsharesRowIndica si se dejará de compartir la fila que contiene la celda cuando se suelta el botón del mouse mientras el puntero está sobre la celda. (Invalida a DataGridViewCell..::.MouseUpUnsharesRow(DataGridViewCellMouseEventArgs)).
Método protegidoOnClickSe le llama al hacer clic en la celda. (Se hereda de DataGridViewCell).
Método protegidoOnContentClickSe le llama al hacer clic en el contenido de la celda. (Invalida a DataGridViewCell..::.OnContentClick(DataGridViewCellEventArgs)).
Método protegidoOnContentDoubleClickSe le llama al hacer doble clic en el contenido de la celda. (Invalida a DataGridViewCell..::.OnContentDoubleClick(DataGridViewCellEventArgs)).
Método protegidoOnDataGridViewChangedSe le llama cuando cambia la propiedad DataGridView de la celda. (Se hereda de DataGridViewCell).
Método protegidoOnDoubleClickSe le llama al hacer doble clic en la celda. (Se hereda de DataGridViewCell).
Método protegidoOnEnterSe le llama cuando el foco se desplaza a una celda. (Se hereda de DataGridViewCell).
Método protegidoOnKeyDownSe le llama cuando se presiona una tecla de carácter mientras el foco está en una celda. (Invalida a DataGridViewCell..::.OnKeyDown(KeyEventArgs, Int32)).
Método protegidoOnKeyPressSe le llama cuando se presiona una tecla mientras el foco está en una celda. (Se hereda de DataGridViewCell).
Método protegidoOnKeyUpSe le llama cuando se suelta una tecla de carácter mientras el foco está en una celda. (Invalida a DataGridViewCell..::.OnKeyUp(KeyEventArgs, Int32)).
Método protegidoOnLeaveSe le llama cuando el foco se desplaza de una celda. (Invalida a DataGridViewCell..::.OnLeave(Int32, Boolean)).
Método protegidoOnMouseClickSe le llama cuando el usuario hace clic en un botón del mouse mientras el puntero está en una celda. (Se hereda de DataGridViewCell).
Método protegidoOnMouseDoubleClickSe le llama cuando el usuario hace clic en un botón del mouse mientras el puntero está en una celda. (Se hereda de DataGridViewCell).
Método protegidoOnMouseDownSe le llama cuando se mantiene presionado el botón del mouse mientras el puntero está en una celda. (Invalida a DataGridViewCell..::.OnMouseDown(DataGridViewCellMouseEventArgs)).
Método protegidoOnMouseEnterSe le llama cuando el puntero del mouse se mueve sobre una celda. (Se hereda de DataGridViewCell).
Método protegidoOnMouseLeaveSe le llama cuando el puntero del mouse se desplaza de una celda. (Invalida a DataGridViewCell..::.OnMouseLeave(Int32)).
Método protegidoOnMouseMoveSe le llama cuando el puntero del mouse se mueve dentro de una celda. (Invalida a DataGridViewCell..::.OnMouseMove(DataGridViewCellMouseEventArgs)).
Método protegidoOnMouseUpSe le llama cuando se suelta el botón del mouse mientras el puntero está en una celda. (Invalida a DataGridViewCell..::.OnMouseUp(DataGridViewCellMouseEventArgs)).
Método protegidoPaintDibuja la celda DataGridViewCheckBoxCell actual. (Invalida a DataGridViewCell..::.Paint(Graphics, Rectangle, Rectangle, Int32, DataGridViewElementStates, Object, Object, String, DataGridViewCellStyle, DataGridViewAdvancedBorderStyle, DataGridViewPaintParts)).
Método protegidoPaintBorderDibuja el borde del control DataGridViewCell actual. (Se hereda de DataGridViewCell).
Método protegidoPaintErrorIconDibuja el icono de error del control DataGridViewCell actual. (Se hereda de DataGridViewCell).
Método públicoParseFormattedValueConvierte un valor con formato para la presentación en un valor de celda real. (Invalida a DataGridViewCell..::.ParseFormattedValue(Object, DataGridViewCellStyle, TypeConverter, TypeConverter)).
Método públicoPositionEditingControlEstablece la ubicación y tamaño del control de edición que hospeda una celda del control DataGridView. (Se hereda de DataGridViewCell).
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. (Se hereda de DataGridViewCell).
Método públicoPrepareEditingCellForEditEste método no es significativo para este tipo.
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. (Se hereda de DataGridViewCell).
Método públicoToStringDevuelve la representación de cadena de la celda. (Invalida a DataGridViewCell..::.ToString()()()).
Arriba

La clase DataGridViewCheckBoxCell es un tipo especializado de DataGridViewCell que se utiliza para mostrar información binaria o ternaria presentada a través de una interfaz de usuario de tipo casilla. En el modo binario predeterminado, las celdas pueden contener valores de true o false. En modo ternario, las celdas toman uno de los valores de CheckState. La propiedad ThreeState determina si está vigente el modo binario o ternario.

DataGridViewCheckBoxColumn corresponde al tipo de columna especializado con el fin de contener celdas de este tipo. De manera predeterminada, la propiedad DataGridViewCheckBoxColumn..::.CellTemplate se inicializa con una nueva DataGridViewCheckBoxCell. Para modelar las celdas dentro de una columna como un control DataGridViewCheckBoxCell 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.

Cuando la celda actual es DataGridViewCheckBoxCell, la propiedad DataGridView..::.IsCurrentCellInEditMode siempre es true.

Normalmente, los valores de celda de casilla de están pensados para almacenamiento, como cualquier otro tipo de datos, o para realizar operaciones masivas. Si desea responder inmediatamente cuando los usuarios hacen clic en una celda de casilla, puede controlar el evento DataGridView..::.CellClick, pero este evento aparece antes de actualizar el valor de la celda. Si necesita el nuevo valor en el momento del clic, una de las opciones es calcular que el valor esperado se basará en el valor actual. Otro enfoque es confirmar inmediatamente el cambio y controlar el evento DataGridView..::.CellValueChanged para responder a él. Para confirmar el cambio cuando se hace clic en la celda, debe controlar el evento DataGridView..::.CurrentCellDirtyStateChanged. En el controlador, si la celda actual es una celda de una casilla, llama al método DataGridView..::.CommitEdit y pase el valor Commit.

Notas para los herederos

Cuando derive del control DataGridViewCheckBoxCell 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.

En el ejemplo de código siguiente se utiliza DataGridViewCheckBoxColumn para hacer un seguimiento de qué empleados están en la oficina. La columna está compuesta de objetos DataGridViewCheckBoxCell. Este ejemplo forma parte de un ejemplo más extenso que está disponible en el tema de información general sobre la clase DataGridViewComboBoxColumn.

Visual Basic
Private Sub AddOutOfOfficeColumn()
    Dim column As New DataGridViewCheckBoxColumn()
    With column
        .HeaderText = ColumnName.OutOfOffice.ToString()
        .Name = ColumnName.OutOfOffice.ToString()
        .AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells
        .FlatStyle = FlatStyle.Standard
        .CellTemplate = New DataGridViewCheckBoxCell()
        .CellTemplate.Style.BackColor = Color.Beige
    End With

    DataGridView1.Columns.Insert(0, column)
End Sub
C#
private void AddOutOfOfficeColumn()
{
    DataGridViewCheckBoxColumn column = new DataGridViewCheckBoxColumn();
    {
        column.HeaderText = ColumnName.OutOfOffice.ToString();
        column.Name = ColumnName.OutOfOffice.ToString();
        column.AutoSizeMode = 
            DataGridViewAutoSizeColumnMode.DisplayedCells;
        column.FlatStyle = FlatStyle.Standard;
        column.ThreeState = true;
        column.CellTemplate = new DataGridViewCheckBoxCell();
        column.CellTemplate.Style.BackColor = Color.Beige;
    }

    DataGridView1.Columns.Insert(0, column);
}
Visual C++
private:
    void AddOutOfOfficeColumn()
    {
        DataGridViewCheckBoxColumn^ column = gcnew DataGridViewCheckBoxColumn();
        {
            column->HeaderText = ColumnName::OutOfOffice.ToString();
            column->Name = ColumnName::OutOfOffice.ToString();
            column->AutoSizeMode = 
                DataGridViewAutoSizeColumnMode::DisplayedCells;
            column->FlatStyle = FlatStyle::Standard;
            column->ThreeState = true;
            column->CellTemplate = gcnew DataGridViewCheckBoxCell();
            column->CellTemplate->Style->BackColor = Color::Beige;
        }

        DataGridView1->Columns->Insert(0, column);
    }

.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