It is not possible to modify the color of the bars and backcolor of a Progressbar directly by properties of control.
The only way to do that is to pass by an API call.
To run this code, you need a form and a progressbar named Progressbar1.
‘*********************************************
'Paste this code in a module or in the general section of a form
‘API DECLARATION
Public Declare Function SendMessage Lib _
"user32" Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
‘CONSTANT DECLARATION
Public Const CCM_FIRST = &H2000
Public Const CCM_SETBKCOLOR = (CCM_FIRST + 1)
Public Const PBM_SETBKCOLOR = CCM_SETBKCOLOR
Public Const WM_USER = &H400
Public Const PBM_SETBARCOLOR = (WM_USER + 9)
‘*********************************************
‘*********************************************
'Paste this code in a form
Private Sub Form_Load()
‘Set the ProgressBar Barcolor with black color
SendMessage ProgressBar1.hwnd, PBM_SETBARCOLOR, 0, ByVal RGB(0, 0, 0)
‘Set the ProgressBar Backcolor with blue color
SendMessage ProgressBar1.hwnd, PBM_SETBKCOLOR, 0, ByVal RGB(0, 0, 127)
End Sub
Comments