Control.GetStyle(ControlStyles) Método

Definição

Recupera o valor do bit de estilo de controlo especificado para o controlo.

protected:
 bool GetStyle(System::Windows::Forms::ControlStyles flag);
protected bool GetStyle(System.Windows.Forms.ControlStyles flag);
member this.GetStyle : System.Windows.Forms.ControlStyles -> bool
Protected Function GetStyle (flag As ControlStyles) As Boolean

Parâmetros

flag
ControlStyles

O ControlStyles bit para devolver o valor.

Devoluções

true se o bit de estilo de controlo especificado for definido para true; caso contrário, false.

Exemplos

O seguinte exemplo de código devolve o valor dos bits de estilo relacionados com duplo buffer para um Form. Este exemplo retorna true apenas se todos os bits de estilo estiverem definidos como true.

public:
   bool DoubleBufferingEnabled()
   {
      
      // Get the value of the double-buffering style bits.
      return this->GetStyle( static_cast<ControlStyles>(ControlStyles::DoubleBuffer | ControlStyles::UserPaint | ControlStyles::AllPaintingInWmPaint) );
   }
public bool DoubleBufferingEnabled()
{
   // Get the value of the double-buffering style bits.
   return this.GetStyle(ControlStyles.DoubleBuffer | 
      ControlStyles.UserPaint | 
      ControlStyles.AllPaintingInWmPaint);
}
Public Function DoubleBufferingEnabled() As Boolean
   ' Get the value of the double-buffering style bits.
   Return Me.GetStyle((ControlStyles.DoubleBuffer _
     Or ControlStyles.UserPaint _
     Or ControlStyles.AllPaintingInWmPaint))
End Function

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 apropriado ControlStyles e o valor booleano para definir o bit. Para determinar o valor atribuído a um bit especificado ControlStyles , use o GetStyle método e passe o ControlStyles membro para avaliar.

Aplica-se a

Ver também