ProgressBarRenderer.ChunkSpaceThickness 속성

정의

진행률 표시줄의 각 내부 조각 사이에 있는 공간의 너비(픽셀)를 가져옵니다.

public:
 static property int ChunkSpaceThickness { int get(); };
public static int ChunkSpaceThickness { get; }
member this.ChunkSpaceThickness : int
Public Shared ReadOnly Property ChunkSpaceThickness As Integer

속성 값

Int32

진행률 표시줄의 각 내부 조각 사이에 있는 공간의 너비(픽셀)입니다.

예외

운영 체제에서 비주얼 스타일을 지원하지 않는 경우

또는

운영 체제에서 사용자가 비주얼 스타일을 사용하지 않도록 설정한 경우

또는

비주얼 스타일이 애플리케이션 창의 클라이언트 영역에 적용되지 않은 경우

예제

다음 코드 예제에서는 합니다 ChunkSpaceThickness 그린 진행률 표시줄의 증가 나타내는 각 사각형의 크기를 결정 하는 속성을 DrawVerticalChunks 메서드. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 ProgressBarRenderer 클래스입니다.

    // Initialize the rectangles used to paint the states of the
    // progress bar.
private:
    void SetupProgressBar()
    {
        if (!ProgressBarRenderer::IsSupported)
        {
            return;
        }

        // Determine the size of the progress bar frame.
        this->Size = System::Drawing::Size(ClientRectangle.Width,
            (NumberChunks * (ProgressBarRenderer::ChunkThickness + 
            (2 * ProgressBarRenderer::ChunkSpaceThickness))) + 6);

        // Initialize the rectangles to draw each step of the
        // progress bar.
        progressBarRectangles = gcnew array<Rectangle>(NumberChunks);

        for (int i = 0; i < NumberChunks; i++)
        {
            // Use the thickness defined by the current visual style
            // to calculate the height of each rectangle. The size
            // adjustments ensure that the chunks do not paint over
            // the frame.

            int filledRectangleHeight = 
                ((i + 1) * (ProgressBarRenderer::ChunkThickness +
                (2 * ProgressBarRenderer::ChunkSpaceThickness)));

            progressBarRectangles[i] = Rectangle(
                ClientRectangle.X + 3,
                ClientRectangle.Y + ClientRectangle.Height - 3
                - filledRectangleHeight,
                ClientRectangle.Width - 6,
                filledRectangleHeight);
        }
    }
// Initialize the rectangles used to paint the states of the 
// progress bar.
private void SetupProgressBar()
{
    if (!ProgressBarRenderer.IsSupported)
    {
        return;
    }

    // Determine the size of the progress bar frame.
    this.Size = new Size(ClientRectangle.Width,
        (NumberChunks) * (ProgressBarRenderer.ChunkThickness +
        (2 * ProgressBarRenderer.ChunkSpaceThickness)) + 6);

    // Initialize the rectangles to draw each step of the 
    // progress bar.
    progressBarRectangles = new Rectangle[NumberChunks];

    for (int i = 0; i < NumberChunks; i++)
    {
        // Use the thickness defined by the current visual style 
        // to calculate the height of each rectangle. The size 
        // adjustments ensure that the chunks do not paint over 
        // the frame.

        int filledRectangleHeight =
            ((i + 1) * (ProgressBarRenderer.ChunkThickness +
            (2 * ProgressBarRenderer.ChunkSpaceThickness)));

        progressBarRectangles[i] = new Rectangle(
            ClientRectangle.X + 3,
            ClientRectangle.Y + ClientRectangle.Height - 3
            - filledRectangleHeight,
            ClientRectangle.Width - 6,
            filledRectangleHeight);
    }
}
' Initialize the rectangles used to paint the states of the 
' progress bar.
Private Sub SetupProgressBar() 
    If Not ProgressBarRenderer.IsSupported Then
        Return
    End If
    
    ' Determine the size of the progress bar frame.
    Me.Size = New Size(ClientRectangle.Width, NumberChunks *(ProgressBarRenderer.ChunkThickness + 2 * ProgressBarRenderer.ChunkSpaceThickness) + 6)
    
    ' Initialize the rectangles to draw each step of the 
    ' progress bar.
    progressBarRectangles = New Rectangle(NumberChunks) {}
    
    Dim i As Integer
    For i = 0 To NumberChunks
        ' Use the thickness defined by the current visual style 
        ' to calculate the height of each rectangle. The size 
        ' adjustments ensure that the chunks do not paint over 
        ' the frame.
        Dim filledRectangleHeight As Integer = (i + 1)  _
    *(ProgressBarRenderer.ChunkThickness + 2 * ProgressBarRenderer.ChunkSpaceThickness)
        
        progressBarRectangles(i) = New Rectangle(ClientRectangle.X + 3, _
            ClientRectangle.Y + ClientRectangle.Height - 3 - filledRectangleHeight, _
            ClientRectangle.Width - 6, filledRectangleHeight)
    Next i

End Sub

설명

이 값은 운영 체제의 현재 비주얼 스타일에 의해 결정 됩니다.

이 속성에 액세스 하기 전에 있는지 확인 해야 합니다 IsSupported 속성이 반환 true합니다.

적용 대상