Control.SetStyle(ControlStyles, Boolean) Método

Definição

Define uma flag especificada ControlStyles para ou truefalse.

protected:
 void SetStyle(System::Windows::Forms::ControlStyles flag, bool value);
protected void SetStyle(System.Windows.Forms.ControlStyles flag, bool value);
member this.SetStyle : System.Windows.Forms.ControlStyles * bool -> unit
Protected Sub SetStyle (flag As ControlStyles, value As Boolean)

Parâmetros

flag
ControlStyles

A ControlStyles broca para ajustar.

value
Boolean

true para aplicar o estilo especificado ao controlo; caso contrário, false.

Exemplos

O exemplo de código seguinte permite o double-buffering num Form e atualiza os estilos para refletir as alterações.

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();
}
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

Observações

Os flags de bit de estilo de controlo são usados para categorizar comportamentos suportados. Um controlo pode ativar um estilo chamando o SetStyle método e passando o bit (ou bits) apropriado ControlStyles e o valor booleano para definir o(s) bit(s). Para determinar o valor atribuído a um bit especificado ControlStyles , use o GetStyle método e passe o ControlStyles membro para avaliar.

Caution

Definir os bits do estilo de controlo pode alterar substancialmente o comportamento do controlo. Revise a ControlStyles documentação de enumeração para compreender os efeitos de alterar os bits de estilo de controlo antes de chamar o SetStyle método.

Aplica-se a

Ver também