Condividi tramite


ProgressBarRenderer.DrawVerticalBar(Graphics, Rectangle) Metodo

Definizione

Disegna un controllo indicatore di stato vuoto che riempie verticalmente.

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)

Parametri

g
Graphics

Oggetto Graphics utilizzato per disegnare l'indicatore di stato.

bounds
Rectangle

Oggetto Rectangle che specifica i limiti dell'indicatore di stato.

Eccezioni

Il sistema operativo non supporta gli stili di visualizzazione.

oppure

Gli stili di visualizzazione sono disabilitati dall'utente nel sistema operativo.

oppure

Gli stili di visualizzazione non vengono applicati all'area client delle finestre dell'applicazione.

Esempio

Nell'esempio di codice seguente viene utilizzato il DrawVerticalBar metodo nel metodo di OnPaint un controllo personalizzato per disegnare una barra di stato vuota. Questo esempio di codice fa parte di un esempio più ampio fornito per la ProgressBarRenderer classe .

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

Commenti

Prima di usare questo metodo, è necessario verificare che la IsSupported proprietà restituisca true.

Si applica a