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 -> unit
Public 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
回 。