ProgressBarRenderer.ChunkSpaceThickness Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the width, in pixels, of the space between each inner piece of the progress bar.
public:
static property int ChunkSpaceThickness { int get(); };
public static int ChunkSpaceThickness { get; }
static member ChunkSpaceThickness : int
Public Shared ReadOnly Property ChunkSpaceThickness As Integer
The width, in pixels, of the space between each inner piece of the progress bar.
The operating system does not support visual styles.
-or-
Visual styles are disabled by the user in the operating system.
-or-
Visual styles are not applied to the client area of application windows.
The following code example uses the ChunkSpaceThickness property to determine the size of each rectangle that represents an increment of the progress bar drawn by the DrawVerticalChunks method. This code example is part of a larger example provided for the ProgressBarRenderer class.
// 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
This value is determined by the current visual style of the operating system.
Before accessing this property, you should verify that the IsSupported property returns true
.
Продукт | Версии |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
Обратна връзка за .NET
.NET е проект с отворен код. Изберете връзка, за да предоставите обратна връзка: