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..::.Style Property

Gets or sets the style for the cell.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)
Visual Basic
<BrowsableAttribute(True)> _
Public Property Style As DataGridViewCellStyle
    Get
    Set
C#
[BrowsableAttribute(true)]
public DataGridViewCellStyle Style { get; set; }
Visual C++
[BrowsableAttribute(true)]
public:
property DataGridViewCellStyle^ Style {
    DataGridViewCellStyle^ get ();
    void set (DataGridViewCellStyle^ value);
}
F#
[<BrowsableAttribute(true)>]
member Style : DataGridViewCellStyle with get, set

The DataGridView control displays its cells using the styles indicated by the cell InheritedStyle property, which inherits styles from other properties of type DataGridViewCellStyle. The styles specified through the Style property override the styles specified through all other cell-style properties, but do not necessarily indicate all the styles that contribute to the cell's appearance.

For more information, see Cell Styles in the Windows Forms DataGridView Control.

The following code example demonstrates how to use the Style property to get the background color of a cell. This example is part of a larger code example provided for the DataGridViewColumn class.

Visual Basic
Private Sub CustomizeCellsInThirdColumn()

    Dim thirdColumn As Integer = 2
    Dim column As DataGridViewColumn = _
        dataGridView.Columns(thirdColumn)
    Dim cell As DataGridViewCell = _
        New DataGridViewTextBoxCell()

    cell.Style.BackColor = Color.Wheat
    column.CellTemplate = cell
End Sub
C#
private void CustomizeCellsInThirdColumn()
{
    int thirdColumn = 2;
    DataGridViewColumn column =
        dataGridView.Columns[thirdColumn];
    DataGridViewCell cell = new DataGridViewTextBoxCell();

    cell.Style.BackColor = Color.Wheat;
    column.CellTemplate = cell;
}
Visual C++
   void CustomizeCellsInThirdColumn()
   {
      int thirdColumn = 2;
      DataGridViewColumn^ column = dataGridView->Columns[ thirdColumn ];
      DataGridViewCell^ cell = gcnew DataGridViewTextBoxCell;
      cell->Style->BackColor = Color::Wheat;
      column->CellTemplate = cell;
   }


.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.
Biblioteca de clases de .NET Framework
DataGridViewCell..::.Style (Propiedad)

Obtiene o establece el estilo de la celda.

Espacio de nombres:  System.Windows.Forms
Ensamblado:  System.Windows.Forms (en System.Windows.Forms.dll)
Visual Basic
<BrowsableAttribute(True)> _
Public Property Style As DataGridViewCellStyle
    Get
    Set
C#
[BrowsableAttribute(true)]
public DataGridViewCellStyle Style { get; set; }
Visual C++
[BrowsableAttribute(true)]
public:
property DataGridViewCellStyle^ Style {
    DataGridViewCellStyle^ get ();
    void set (DataGridViewCellStyle^ value);
}
F#
[<BrowsableAttribute(true)>]
member Style : DataGridViewCellStyle with get, set

El control DataGridView muestra sus celdas usando los estilos que indica la propiedad InheritedStyle de la celda, que hereda estilos de otras propiedades de tipo DataGridViewCellStyle. Los estilos que se concretan mediante la propiedad Style reemplazan los estilos que se especifican a través de todas las demás propiedades de estilo de celda, aunque no indican necesariamente todos los estilos que contribuyen a la apariencia de la celda.

Para obtener más información, vea Estilos de celda en el control DataGridView de formularios Windows Forms.

En el ejemplo de código siguiente se muestra cómo se utiliza la propiedad Style para obtener el color de fondo de una celda. Este ejemplo forma parte de un ejemplo de código más extenso referente a la clase DataGridViewColumn.

Visual Basic
Private Sub CustomizeCellsInThirdColumn()

    Dim thirdColumn As Integer = 2
    Dim column As DataGridViewColumn = _
        dataGridView.Columns(thirdColumn)
    Dim cell As DataGridViewCell = _
        New DataGridViewTextBoxCell()

    cell.Style.BackColor = Color.Wheat
    column.CellTemplate = cell
End Sub
C#
private void CustomizeCellsInThirdColumn()
{
    int thirdColumn = 2;
    DataGridViewColumn column =
        dataGridView.Columns[thirdColumn];
    DataGridViewCell cell = new DataGridViewTextBoxCell();

    cell.Style.BackColor = Color.Wheat;
    column.CellTemplate = cell;
}
Visual C++
   void CustomizeCellsInThirdColumn()
   {
      int thirdColumn = 2;
      DataGridViewColumn^ column = dataGridView->Columns[ thirdColumn ];
      DataGridViewCell^ cell = gcnew DataGridViewTextBoxCell;
      cell->Style->BackColor = Color::Wheat;
      column->CellTemplate = cell;
   }


.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.
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