TextBoxRenderer.IsSupported Propriété

Définition

Obtient une valeur indiquant si la classe TextBoxRenderer peut être utilisée pour dessiner une zone de texte avec des styles visuels.

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

Valeur de propriété

true si l'utilisateur a activé les styles visuels dans le système d'exploitation et s'ils sont appliqués à la zone client des fenêtres d'application ; sinon false.

Exemples

L’exemple de code suivant utilise la IsSupported propriété pour déterminer s’il faut utiliser la DrawTextBox méthode . Cet exemple de code fait partie d’un exemple plus grand fourni pour la TextBoxRenderer classe .

    // 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

Remarques

Si cette propriété est false, la DrawTextBox méthode lève un InvalidOperationException.

S’applique à

Voir aussi