龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 软件开发 > VB开发 >

利用VB2005制作颜色渐变的进度条[组图](8)

时间:2009-12-30 15:42来源:未知 作者:admin 点击:
分享到:
每个画笔填充颜色占用的宽度 height = CSng(Me.ClientRectangle.Height - BorderWidth) 根据当前百分比所占用的宽度使用画笔填充颜色 For x = halfBorder To totalWidth Step bar

        '每个画笔填充颜色占用的宽度

        height = CSng(Me.ClientRectangle.Height - BorderWidth) 

        '根据当前百分比所占用的宽度使用画笔填充颜色

        For x = halfBorder To totalWidth Step barWidth

            e.Graphics.FillRectangle(lstBrushes(idxColor), x, halfBorder, barWidth, height)

            If idxColor < lstBrushes.Count Then

                idxColor += 1

            End If

        Next

        '当进度为100%的,使用最后一个画笔填充颜色.

        If (x < (Me.ClientRectangle.Width - halfBorder)) And percentComplete = 1.0 Then

            If idxColor < lstBrushes.Count Then

                e.Graphics.FillRectangle(lstBrushes(idxColor), x, halfBorder, ((Me.ClientRectangle.Width - halfBorder) - x), height)

            End If

        End If

    End Sub

End Class

精彩图集

赞助商链接