다음을 통해 공유


ProgressBarRenderer.DrawVerticalChunks(Graphics, Rectangle) 메서드

정의

세로 진행률 표시줄을 채우는 진행률 표시줄 조각 집합을 그립니다.

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

매개 변수

g
Graphics

Graphics 진행률 표시줄을 그리는 데 사용됩니다.

bounds
Rectangle

Rectangle 진행률 표시줄 조각으로 채울 범위를 지정하는 값입니다.

예외

운영 체제는 비주얼 스타일을 지원하지 않습니다.

-또는-

운영 체제의 사용자가 비주얼 스타일을 사용하지 않도록 설정합니다.

-또는-

시각적 스타일은 애플리케이션 창의 클라이언트 영역에 적용되지 않습니다.

예제

다음 코드 예제에서는 이벤트 처리기의 메서드를 Timer.Tick 사용하여 DrawVerticalChunks 진행률 표시줄의 각 증분을 그립니다. 이 코드 예제는 클래스에 제공된 더 큰 예제의 ProgressBarRenderer 일부입니다.

    // Handle the timer tick; draw each progressively larger rectangle.
private:
    void progressTimer_Tick(Object^ myObject, EventArgs^ e)
    {
        if (ticks < NumberChunks)
        {
            Graphics^ g = this->CreateGraphics();
            ProgressBarRenderer::DrawVerticalChunks(g,
                progressBarRectangles[ticks]);
            ticks++;
        }
        else
        {
            progressTimer->Enabled = false;
        }
    }
// Handle the timer tick; draw each progressively larger rectangle.
private void progressTimer_Tick(Object myObject, EventArgs e)
{
    if (ticks < NumberChunks)
    {
        using (Graphics g = this.CreateGraphics())
        {
            ProgressBarRenderer.DrawVerticalChunks(g,
                progressBarRectangles[ticks]);
            ticks++;
        }
    }
    else
    {
        progressTimer.Enabled = false;
    }
}
' Handle the timer tick; draw each progressively larger rectangle.
Private Sub progressTimer_Tick(ByVal myObject As [Object], ByVal e As EventArgs) 
    If ticks < NumberChunks Then
        Dim g As Graphics = Me.CreateGraphics()
        Try
            ProgressBarRenderer.DrawVerticalChunks(g, progressBarRectangles(ticks))
            ticks += 1
        Finally
            g.Dispose()
        End Try
    Else
        progressTimer.Enabled = False
    End If

End Sub

설명

이 메서드에서 그린 각 진행률 표시줄 조각은 매개 변수의 너비에 bounds 걸쳐 있습니다. 그리는 진행률 표시줄 조각의 수는 높이 bounds 와 반환 ChunkSpaceThickness 된 값 및 ChunkThickness.

이 메서드를 사용하기 전에 속성이 IsSupported 반환 true되는지 확인해야 합니다.

적용 대상