TabRenderer.IsSupported Propriété

Définition

Obtient une valeur indiquant si la classe TabRenderer peut être utilisée pour dessiner un contrôle onglet avec des styles visuels.

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

Valeur de propriété

Boolean

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 les méthodes et DrawTabItem les DrawTabPage méthodes. Cet exemple de code fait partie d’un exemple plus grand fourni pour la TabRenderer classe.

    // Draw the tab page and the tab items.
protected:
    virtual void OnPaint(PaintEventArgs^ e) override
    {
        __super::OnPaint(e);

        if (!TabRenderer::IsSupported)
        {
            this->Parent->Text = "CustomTabControl Disabled";
            return;
        }

        TabRenderer::DrawTabPage(e->Graphics, tabPageRectangle);
        TabRenderer::DrawTabItem(e->Graphics, tabItemRectangle1,
            tab1Text, this->Font, tab1Focused, tab1State);
        TabRenderer::DrawTabItem(e->Graphics, tabItemRectangle2,
            tab2Text, this->Font, tab2Focused, tab2State);

        this->Parent->Text = "CustomTabControl Enabled";
    }
// Draw the tab page and the tab items.
protected override void OnPaint(PaintEventArgs e)
{
    base.OnPaint(e);

    if (!TabRenderer.IsSupported)
    {
        this.Parent.Text = "CustomTabControl Disabled";
        return;
    }

    TabRenderer.DrawTabPage(e.Graphics, tabPageRectangle);
    TabRenderer.DrawTabItem(e.Graphics, tabItemRectangle1,
        tab1Text, this.Font, tab1Focused, tab1State);
    TabRenderer.DrawTabItem(e.Graphics, tabItemRectangle2,
        tab2Text, this.Font, tab2Focused, tab2State);

    this.Parent.Text = "CustomTabControl Enabled";
}
' Draw the tab page and the tab items.
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
    MyBase.OnPaint(e)

    If Not TabRenderer.IsSupported Then
        Me.Parent.Text = "CustomTabControl Disabled"
        Return
    End If

    TabRenderer.DrawTabPage(e.Graphics, tabPageRectangle)
    TabRenderer.DrawTabItem(e.Graphics, tabItemRectangle1, _
        tab1Text, Me.Font, tab1Focused, tab1State)
    TabRenderer.DrawTabItem(e.Graphics, tabItemRectangle2, _
        tab2Text, Me.Font, tab2Focused, tab2State)
    Me.Parent.Text = "CustomTabControl Enabled"
End Sub

Remarques

Si cette propriété est false, les DrawTabPage DrawTabItem méthodes lèvent un InvalidOperationException.

S’applique à

Voir aussi