ProgressBarRenderer.ChunkSpaceThickness Propriété

Définition

Obtient la largeur, en pixels, de l'espace entre chaque fragment interne de la barre de progression.

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

Valeur de propriété

Int32

Largeur, en pixels, de l'espace entre chaque fragment interne de la barre de progression.

Exceptions

Le système d'exploitation ne prend pas en charge les styles visuels.

  • ou -

Les styles visuels sont désactivés par l'utilisateur dans le système d'exploitation.

  • ou -

Les styles visuels ne sont pas appliqués à la zone client des fenêtres d'application.

Exemples

L’exemple de code suivant utilise la ChunkSpaceThickness propriété pour déterminer la taille de chaque rectangle qui représente un incrément de la barre de progression dessinée par la DrawVerticalChunks méthode. Cet exemple de code fait partie d’un exemple plus grand fourni pour la ProgressBarRenderer classe.

    // 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

Remarques

Cette valeur est déterminée par le style visuel actuel du système d’exploitation.

Avant d’accéder à cette propriété, vous devez vérifier que la IsSupported propriété retourne true.

S’applique à