ProgressBarRenderer.IsSupported Property

Definition

Gets a value indicating whether the ProgressBarRenderer class can be used to draw a progress bar control with visual styles.

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

Property Value

true if the user has enabled visual styles in the operating system and visual styles are applied to the client area of application windows; otherwise, false.

Examples

The following code example uses the IsSupported property to determine whether to call the DrawVerticalBar method. This code example is part of a larger example provided for the ProgressBarRenderer class.

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

Remarks

If this property is false, the methods and properties of this class will throw an InvalidOperationException.

Applies to

See also