利用VB2005制作颜色渐变的进度条[组图](4)
'交换值
Private Sub Swap(ByRef val1 As Integer, ByRef val2 As Integer)
Dim temp As Integer
temp = val1
val1 = val2
val2 = temp
End Sub
Public Sub New()
InitializeComponent()
Me.BorderStyle = Windows.Forms.BorderStyle.Fixed3D '设置窗体为凹陷的效果
'最简单的实现双缓冲绘图
'AllPaintingInWmPaint 忽略系统消息,防止图像闪烁
'DoubleBuffer 设置双缓冲,防止图像抖动
'UserPaint 自己为控件做所有的绘图操作
'Opaque 使窗体绘制时,不绘制背景
Me.SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or ControlStyles.DoubleBuffer Or ControlStyles.Opaque, True)
'更新风格
Me.UpdateStyles()
'新建颜色列表,加入红色,桔黄色,黄色,绿色,蓝绿色,蓝色,深蓝色,紫色
lstDefault = New List(Of Color)
lstDefault.Add(Color.Red)
lstDefault.Add(Color.Orange)
lstDefault.Add(Color.Yellow)