TabRenderer.IsSupported Właściwość

Definicja

Pobiera wartość wskazującą, czy TabRenderer klasa może służyć do rysowania kontrolki tabulatora ze stylami wizualizacji.

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

Wartość właściwości

Boolean

true jeśli użytkownik włączył style wizualne w systemie operacyjnym i stylach wizualnych są stosowane do obszaru klienta okien aplikacji; w przeciwnym razie , false.

Przykłady

Poniższy przykład kodu używa właściwości , IsSupported aby określić, czy używać DrawTabPage metod i DrawTabItem . Ten przykład kodu jest częścią większego przykładu podanego TabRenderer dla klasy.

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

Uwagi

Jeśli ta właściwość to false, metody i DrawTabItem będą zgłaszać wartość InvalidOperationExceptionDrawTabPage .

Dotyczy

Zobacz też