Public Class Form1
Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal
msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Enum ProgressBarColor
Green = &H1
Red = &H2
Yellow = &H3
End Enum
Private Shared Sub ChangeProgBarColor(ByVal ProgressBar_Name As
Windows.Forms.ProgressBar, ByVal ProgressBar_Color As ProgressBarColor)
SendMessage(ProgressBar_Name.Handle, &H410, ProgressBar_Color, 0)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
ChangeProgBarColor(ProgressBar1, ProgressBarColor.Red)
Timer1.Start()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
ProgressBar1.Value = 0
ChangeProgBarColor(ProgressBar1, ProgressBarColor.Green)
Timer1.Start()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
ProgressBar1.Value = 0
ChangeProgBarColor(ProgressBar1, ProgressBarColor.Yellow)
Timer1.Start()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
ProgressBar1.Value += 1
End Sub
End Class