Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.Net][SRC]ProgressBar Color
#1
[Image: capture-5.gif]

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
[Image: BKlNU.png]

---------
Reply
#2
it's ok, id give it more of a spice up thoufhghg
Reply
#3
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
Reply
#4
Good idea, but i prefer my source code... I don't know why.
[Image: BKlNU.png]

---------
Reply
#5
that may come in handy, thanks.
Reply
#6
(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)
Reply
#7
(06-24-2012, 11:13 AM)AceInfinity Wrote: You like typing out extra stuff? lol

Exactly, i love that xD
Thanks for your "help"
;)
[Image: BKlNU.png]

---------
Reply
#8
This is good, it's just a shame that only three colours are supported.
[Image: cooldude.png]

(09-05-2011, 08:36 AM)Orgy Wrote: If you understand what you're doing, you aren't learning anything. ;)
Reply
#9
(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.
[Image: BKlNU.png]

---------
Reply
#10
(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 Unsure

Not using this method anyways you can't... You find me another color, then tell me that i'm wrong here.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [VB.NET] Animated Form Extend [SRC] Fragma 6 5,537 10-10-2013, 12:18 PM
Last Post: Saket
  [VB.Net][SRC] YouTube Bot HF~Legend 5 3,656 11-25-2012, 05:54 AM
Last Post: Ixam
  VB.NET Wrap Color BBCode Tags [Reply] AceInfinity 8 2,710 03-15-2012, 08:59 PM
Last Post: AceInfinity
  [VB.NET] Basic Reverse Connection RAT [SRC] hasam 1 3,047 02-01-2012, 03:10 PM
Last Post: AceInfinity
  VB.NET Computer Information [SRC] Fragma 35 17,069 01-07-2012, 03:56 PM
Last Post: Quantum

Forum Jump:


Users browsing this thread: 2 Guest(s)