ProgressBarRenderer.DrawVerticalChunks(Graphics, Rectangle) 方法     
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
绘制填充垂直进度栏的一组进度栏格。
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 -> unitPublic Shared Sub DrawVerticalChunks (g As Graphics, bounds As Rectangle)参数
例外
示例
下面的代码示例在 DrawVerticalChunks 事件处理程序中使用 Timer.Tick 方法绘制进度条的每个增量。 此代码示例是为 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 以及 和 ChunkSpaceThicknessChunkThickness返回的值。
在使用此方法之前,应验证 属性是否 IsSupported 返回 true。