ProgressBarRenderer.DrawVerticalBar(Graphics, Rectangle) 方法     
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
绘制一个垂直填充的空白进度栏控件。
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 -> unitPublic Shared Sub DrawVerticalBar (g As Graphics, bounds As Rectangle)参数
例外
示例
下面的代码示例使用 DrawVerticalBar 自定义控件 OnPaint 方法中的方法绘制空进度栏。 此代码示例是为类提供的大型示例的 ProgressBarRenderer 一部分。
    // 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
注解
使用此方法之前,应验证 IsSupported 属性是否 true返回 。