ProgressBarRenderer.DrawVerticalBar(Graphics, Rectangle) Metoda

Definice

Nakreslí prázdný ovládací prvek indikátoru průběhu, který se vyplní svisle.

public:
 static void DrawVerticalBar(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds);
public static void DrawVerticalBar (System.Drawing.Graphics g, System.Drawing.Rectangle bounds);
static member DrawVerticalBar : System.Drawing.Graphics * System.Drawing.Rectangle -> unit
Public Shared Sub DrawVerticalBar (g As Graphics, bounds As Rectangle)

Parametry

g
Graphics

Používá Graphics se k kreslení indikátoru průběhu.

bounds
Rectangle

Určuje Rectangle hranice indikátoru průběhu.

Výjimky

Operační systém nepodporuje vizuální styly.

-nebo-

Vizuální styly jsou zakázány uživatelem v operačním systému.

-nebo-

Vizuální styly se nepoužívají v oblasti klienta oken aplikací.

Příklady

Následující příklad kódu používá metodu DrawVerticalBar v metodě vlastního ovládacího prvku OnPaint k vykreslení prázdného indikátoru průběhu. Tento příklad kódu je součástí většího příkladu zadaného ProgressBarRenderer pro třídu.

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

Poznámky

Před použitím této metody byste měli ověřit, že IsSupported vlastnost vrátí true.

Platí pro