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 _
)
Dim flag As ControlStyles
Dim value As Boolean
Me.SetStyle(flag, value)
protected void SetStyle (
ControlStyles flag,
bool value
)
protected:
void SetStyle (
ControlStyles flag,
bool value
)
protected void SetStyle (
ControlStyles flag,
boolean value
)
protected function SetStyle (
flag : ControlStyles,
value : boolean
)
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.
Precaució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.
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
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();
}
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();
}
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