Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Change ProgressBar Color
Author:
Komal Paudyal
E-mail:
Click to e-mail author
Submitted:
8/1/2013
Version:
VB 2012
Compatibility:
VB 2012
Category:
Forms
Views:
15729
With This code you can change the progressbar green color to RED, YELLOW ETC.
Declarations:
'none
Code:
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 If ProgressBar1.Value = 99 Then Timer1.Stop() End If End Sub
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement