ProgressBarRenderer.ChunkThickness Proprietà

Definizione

Ottiene la larghezza, in pixel, di una singola porzione interna dell'indicatore di stato.

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

Valore della proprietà

Larghezza, in pixel, di una singola porzione interna dell'indicatore di stato.

Eccezioni

Il sistema operativo non supporta gli stili di visualizzazione.

-oppure-

Gli stili di visualizzazione sono stati disabilitati dall'utente nel sistema operativo.

-oppure-

Gli stili di visualizzazione non sono stati applicati all'area client delle finestre dell'applicazione.

Esempio

Nell'esempio di codice seguente viene utilizzata la ChunkThickness proprietà per determinare le dimensioni di ogni rettangolo che rappresenta un incremento della barra di stato disegnata dal DrawVerticalChunks metodo . Questo esempio di codice fa parte di un esempio più grande fornito per 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

Commenti

Questo valore è determinato dallo stile visivo corrente del sistema operativo.

Prima di accedere a questa proprietà, è necessario verificare che la IsSupported proprietà restituisca true.

Si applica a