Support Forums
[VB.Net][SRC]ProgressBar Color - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Visual Basic and the .NET Framework (https://www.supportforums.net/forumdisplay.php?fid=19)
+---- Thread: [VB.Net][SRC]ProgressBar Color (/showthread.php?tid=26574)

Pages: 1 2


[VB.Net][SRC]ProgressBar Color - HF~Legend - 06-22-2012

[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


RE: ProgressBar Color - eiqhtworks - 06-22-2012

it's ok, id give it more of a spice up thoufhghg


RE: [VB.Net][SRC]ProgressBar Color - AceInfinity - 06-23-2012

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



RE: [VB.Net][SRC]ProgressBar Color - HF~Legend - 06-23-2012

Good idea, but i prefer my source code... I don't know why.


RE: [VB.Net][SRC]ProgressBar Color - kpn37z - 06-24-2012

that may come in handy, thanks.


RE: [VB.Net][SRC]ProgressBar Color - AceInfinity - 06-24-2012

(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)



RE: [VB.Net][SRC]ProgressBar Color - HF~Legend - 06-24-2012

(06-24-2012, 11:13 AM)AceInfinity Wrote: You like typing out extra stuff? lol

Exactly, i love that xD
Thanks for your "help"
;)


RE: [VB.Net][SRC]ProgressBar Color - ★Cooldude★ - 06-25-2012

This is good, it's just a shame that only three colours are supported.


RE: [VB.Net][SRC]ProgressBar Color - HF~Legend - 06-25-2012

(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.


RE: [VB.Net][SRC]ProgressBar Color - AceInfinity - 06-25-2012

(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.