TextBoxRenderer.IsSupported Propiedad

Definición

Obtiene un valor que indica si la clase TextBoxRenderer puede utilizarse para dibujar un cuadro de texto con estilos visuales.

public:
 static property bool IsSupported { bool get(); };
public static bool IsSupported { get; }
static member IsSupported : bool
Public Shared ReadOnly Property IsSupported As Boolean

Valor de propiedad

Es true si el usuario ha habilitado los estilos visuales en el sistema operativo y se aplican al área cliente de las ventanas de aplicación; de lo contrario, es false.

Ejemplos

En el ejemplo de código siguiente se usa la IsSupported propiedad para determinar si se debe usar el DrawTextBox método . Este ejemplo de código es parte de un ejemplo mayor proporcionado para la clase TextBoxRenderer.

    // Use DrawText with the current TextFormatFlags.

protected:
    virtual void OnPaint(PaintEventArgs^ e) override
    {
        __super::OnPaint(e);

        if (TextBoxRenderer::IsSupported)
        {
            TextBoxRenderer::DrawTextBox(e->Graphics, textBorder, this->Text,
                this->Font, textRectangle, textFlags, TextBoxState::Normal);

            this->Parent->Text = "CustomTextBox Enabled";
        }
        else
        {
            this->Parent->Text = "CustomTextBox Disabled";
        }
    }
// Use DrawText with the current TextFormatFlags.
protected override void OnPaint(PaintEventArgs e)
{
    base.OnPaint(e);

    if (TextBoxRenderer.IsSupported)
    {
        TextBoxRenderer.DrawTextBox(e.Graphics, textBorder, this.Text,
            this.Font, textRectangle, textFlags, TextBoxState.Normal);

        this.Parent.Text = "CustomTextBox Enabled";
    }
    else
    {
        this.Parent.Text = "CustomTextBox Disabled";
    }
}
' Use DrawText with the current TextFormatFlags.
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
    MyBase.OnPaint(e)

    If TextBoxRenderer.IsSupported Then
        TextBoxRenderer.DrawTextBox(e.Graphics, textBorder, Me.Text, _
            Me.Font, textRectangle, textFlags, TextBoxState.Normal)
        Me.Parent.Text = "CustomTextBox Enabled"
    Else
        Me.Parent.Text = "CustomTextBox Disabled"
    End If
End Sub

Comentarios

Si esta propiedad es false, el DrawTextBox método iniciará una InvalidOperationExceptionexcepción .

Se aplica a

Consulte también