ProgressBarRenderer.IsSupported Właściwość

Definicja

Pobiera wartość wskazującą, czy ProgressBarRenderer klasa może służyć do rysowania kontrolki paska postępu ze stylami wizualizacji.

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

Wartość właściwości

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 w IsSupported celu określenia, czy wywołać metodę DrawVerticalBar . Ten przykład kodu jest częścią większego przykładu podanego ProgressBarRenderer dla klasy.

    // Draw the progress bar in its normal state.
protected:
    virtual void OnPaint(PaintEventArgs^ e) override
    {
        __super::OnPaint(e);

        if (ProgressBarRenderer::IsSupported)
        {
            ProgressBarRenderer::DrawVerticalBar(e->Graphics, 
                ClientRectangle);
            this->Parent->Text = "VerticalProgressBar Enabled";
        }
        else
        {
            this->Parent->Text = "VerticalProgressBar Disabled";
        }
    }
// Draw the progress bar in its normal state.
protected override void OnPaint(PaintEventArgs e)
{
    base.OnPaint(e);

    if (ProgressBarRenderer.IsSupported)
    {
        ProgressBarRenderer.DrawVerticalBar(e.Graphics,
            ClientRectangle);
        this.Parent.Text = "VerticalProgressBar Enabled";
    }
    else
    {
        this.Parent.Text = "VerticalProgressBar Disabled";
    }
}
' Draw the progress bar in its normal state.
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) 
    MyBase.OnPaint(e)
    
    If ProgressBarRenderer.IsSupported Then
        ProgressBarRenderer.DrawVerticalBar(e.Graphics, ClientRectangle)
        Me.Parent.Text = "VerticalProgressBar Enabled"
    Else
        Me.Parent.Text = "VerticalProgressBar Disabled"
    End If

End Sub

Uwagi

Jeśli ta właściwość to false, metody i właściwości tej klasy będą zgłaszać wartość InvalidOperationException.

Dotyczy

Zobacz też