Versión imprimible       Enviar     
Evaluar y enviar comentarios

  Encender vista de ancho de banda bajo
Esta página es específica de
Microsoft Visual Studio 2005/.NET Framework 2.0

Hay además otras versiones disponibles para:
Control.SetStyle (Método)
Establece el bit de estilo especificado en el valor especificado.

Espacio de nombres: System.Windows.Forms
Ensamblado: System.Windows.Forms (en system.windows.forms.dll)

Visual Basic (Declaración)
Protected Sub SetStyle ( _
    flag As ControlStyles, _
    value As Boolean _
)
Visual Basic (Uso)
Dim flag As ControlStyles
Dim value As Boolean

Me.SetStyle(flag, value)
C#
protected void SetStyle (
    ControlStyles flag,
    bool value
)
C++
protected:
void SetStyle (
    ControlStyles flag, 
    bool value
)
J#
protected void SetStyle (
    ControlStyles flag, 
    boolean value
)
JScript
protected function SetStyle (
    flag : ControlStyles, 
    value : boolean
)
XAML
No aplicable.

Parámetros

flag

Bit ControlStyles que se va a establecer.

value

Es true para aplicar el estilo especificado al control; en caso contrario, es false.

Los indicadores de bits de estilo de controles se utilizan para clasificar por categorías los comportamientos admitidos. Un control puede habilitar un estilo llamando al método SetStyle y pasando el bit o los bits ControlStyles correspondientes y el valor de tipo booleano en el que va a establecerse el bit o los bits. Para determinar el valor asignado a un bit ControlStyles especificado, utilice el método GetStyle y pase el miembro ControlStyles que se va a evaluar.

Nota de precauciónPrecaución:

Establecer los bits de estilo de control puede modificar sustancialmente el comportamiento del control. Hay que revisar la documentación de la enumeración de ControlStyles para comprender los efectos de modificar los bits de estilo del control antes de llamar al método SetStyle.

En el siguiente ejemplo de código se habilita el doble búfer en un Form y se actualizan los estilos para reflejar los cambios.

Visual Basic
Public Sub EnableDoubleBuffering()
   ' Set the value of the double-buffering style bits to true.
   Me.SetStyle(ControlStyles.DoubleBuffer _
     Or ControlStyles.UserPaint _
     Or ControlStyles.AllPaintingInWmPaint, _
     True)
   Me.UpdateStyles()
End Sub
C#
public void EnableDoubleBuffering()
{
   // Set the value of the double-buffering style bits to true.
   this.SetStyle(ControlStyles.DoubleBuffer | 
      ControlStyles.UserPaint | 
      ControlStyles.AllPaintingInWmPaint,
      true);
   this.UpdateStyles();
}
C++
public:
   void EnableDoubleBuffering()
   {
      // Set the value of the double-buffering style bits to true.
      this->SetStyle( static_cast<ControlStyles>(ControlStyles::DoubleBuffer | ControlStyles::UserPaint | ControlStyles::AllPaintingInWmPaint), true );
      this->UpdateStyles();
   }
J#
public void EnableDoubleBuffering()
{
    // Set the value of the double-buffering style bits to true.
    this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | 
        ControlStyles.AllPaintingInWmPaint, true);
    this.UpdateStyles();
} //EnableDoubleBuffering

Windows 98, Windows 2000 Service Pack 4, Windows Millennium, Windows Server 2003, Windows XP Media Center, Windows XP Professional x64, Windows XP SP2, Windows XP Starter

Microsoft .NET Framework 3.0 es compatible con Windows Vista, Microsoft Windows XP SP2 y Windows Server 2003 SP1.

.NET Framework

Compatible con: 3.0, 2.0, 1.1, 1.0
© 2009 Microsoft Corporation. Reservados todos los derechos. Términos de uso  |  Marcas Registradas  |  Privacidad
Page view tracker