次の方法で共有


ProgressBarRenderer.DrawVerticalBar(Graphics, Rectangle) メソッド

定義

垂直方向に塗りつぶす空の進行状況バー コントロールを描画します。

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)

パラメーター

g
Graphics

進行状況バーの描画に使用する Graphics

bounds
Rectangle

進行状況バーの境界を指定する Rectangle

例外

オペレーティング システムでは、ビジュアル スタイルはサポートされていません。

-又は-

ビジュアル スタイルは、オペレーティング システムのユーザーによって無効になります。

-又は-

ビジュアル スタイルは、アプリケーション ウィンドウのクライアント領域には適用されません。

次のコード例では、カスタム コントロールの OnPaint メソッドのDrawVerticalBar メソッドを使用して、空の進行状況バーを描画します。 このコード例は、 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を返していることを確認する必要があります。

適用対象