Posts: 85
Threads: 23
Joined: Nov 2011
Reputation:
2
06-22-2012, 02:58 PM
(This post was last modified: 06-22-2012, 04:37 PM by HF~Legend.)
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
Code: 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
Private Sub btnYellow_Click(sender As System.Object, e As System.EventArgs) Handles btnYellow.Click
SendMessage(ProgressBar1.Handle, &H400 + 16, &H3, 0) 'YELLOW
End Sub
Private Sub btnRed_Click(sender As System.Object, e As System.EventArgs) Handles btnRed.Click
SendMessage(ProgressBar1.Handle, &H400 + 16, &H2, 0) 'RED
End Sub
Private Sub btnGreen_Click(sender As System.Object, e As System.EventArgs) Handles btnGreen.Click
SendMessage(ProgressBar1.Handle, &H400 + 16, &H1, 0) 'GREEN
End Sub
End Class
Source : unknown
---------
Posts: 9
Threads: 2
Joined: Jun 2012
it's ok, id give it more of a spice up thoufhghg
Posts: 5,793
Threads: 268
Joined: Sep 2010
Reputation:
85
06-23-2012, 04:35 PM
(This post was last modified: 06-24-2012, 11:15 AM by AceInfinity.)
Why not just send the msg of &H10, instead of &H400 + 16? That's like someone asking you how many hours you put in for work, and instead of saying 40, you say 10 + 10 + 10 + 10.
I would have set it up like this, maybe in a Module too:
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(ProgressBar_Name As ProgressBar, ProgressBar_Color As ProgressBarColor)
SendMessage(ProgressBar_Name.Handle, &H410, ProgressBar_Color, 0)
End Sub
Posts: 85
Threads: 23
Joined: Nov 2011
Reputation:
2
Good idea, but i prefer my source code... I don't know why.
---------
Posts: 15
Threads: 5
Joined: Jun 2012
Reputation:
0
that may come in handy, thanks.
Posts: 5,793
Threads: 268
Joined: Sep 2010
Reputation:
85
06-24-2012, 11:13 AM
(This post was last modified: 06-24-2012, 11:14 AM by AceInfinity.)
(06-23-2012, 05:54 PM)HF~Legend Wrote: Good idea, but i prefer my source code... I don't know why.
You like typing out extra stuff? lol
With my methodology, all you'd have to do is:
Code: ChangeProgBarColor(ProgressBar1, ProgressBarColor.Red)
Posts: 85
Threads: 23
Joined: Nov 2011
Reputation:
2
(06-24-2012, 11:13 AM)AceInfinity Wrote: You like typing out extra stuff? lol
Exactly, i love that xD
Thanks for your "help" ;)
---------
Posts: 228
Threads: 7
Joined: Sep 2010
Reputation:
5
This is good, it's just a shame that only three colours are supported.
(09-05-2011, 08:36 AM)Orgy Wrote: If you understand what you're doing, you aren't learning anything. ;)
Posts: 85
Threads: 23
Joined: Nov 2011
Reputation:
2
06-25-2012, 07:15 AM
(This post was last modified: 06-25-2012, 07:16 AM by HF~Legend.)
(06-25-2012, 03:43 AM)★Cooldude★ Wrote: This is good, it's just a shame that only three colours are supported.
Yes, but you can add all color, as you wish ... I just put three color for example.
---------
Posts: 5,793
Threads: 268
Joined: Sep 2010
Reputation:
85
06-25-2012, 07:04 PM
(This post was last modified: 06-25-2012, 07:05 PM by AceInfinity.)
(06-25-2012, 07:15 AM)HF~Legend Wrote: Yes, but you can add all color, as you wish ... I just put three color for example.
Uh, nope
Not using this method anyways you can't... You find me another color, then tell me that i'm wrong here.
|