Matteo Montanari Matteo Montanari - 1 year ago 299 Question

Visual studio Progressbar control: blue color

using the progressbar control i can only use the default green one.

Looking in windows 7 i have noticed this control, see image below.

enter image description here

I found this article:
Windows ProgressBar

My question is, how to use this control in Visual Studio 2013 labelling a blue progress bar?


Edit: i would like the blue color, not the red, yellow or green one. This control is called "meter".

Answer Source

Sorry but its not Accessible as stated:

In Windows Vista, progressbars come in different flavors, the most common progressbar being the green one. However, there are also the red and yellow versions as well (there is a blue version, known as a meter, but that is inaccessible). The progressbar colors seem to correspond to specific progressbar states. You can set these states using the PBM_SETSTATE [0x40F] message. The states are PBST_NORMAL [0x0001], PBST_ERROR [0x0002] and PBST_PAUSE [0x0003].

But if you are interested it is possible to access the Red and Yellow Color using the following:

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 ProgressBar, ByVal ProgressBar_Color As ProgressBarColor)
    SendMessage(ProgressBar_Name.Handle, &H410, ProgressBar_Color, 0)
End Sub

Example of Usage:

ChangeProgBarColor(Progress_Bar, ProgressBarColor.Red)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download