以下是一个改变ProgressBar的例子!BackColor and BarColor of a ProgressBar - BackColor and BarColor of a ProgressBar
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 formPrivate 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
先谢谢你,但我试验发现这样做对Toolbar不起作用;
而对于StatusBar随然能将颜色改变,但在StatusBar的右下角的那个地方却还是原先的那个颜色。
请问应怎么办?
这么说,你是要改变Toolbar和StatusBar的颜色了?
我写写试试!