Public Sub ChangPBColor(ByVal ipProgBarHwnd As Long, Optional ByVal ipfColor As Long, Optional ByVal ipbColor As Long) If ipfColor <> 0 Then Call SendMessage(ipProgBarHwnd, PBM_SETBARCOLOR, 0, ByVal ipfColor) If ipbColor <> 0 Then Call SendMessage(ipProgBarHwnd, PBM_SETBKCOLOR, 0, ByVal ipbColor)End Sub
MSDN中关于这个消息的说明。PBM_SETBARCOLORPBM_SETBARCOLOR wParam = 0; lParam = (LPARAM)(COLORREF)clrBar;Sets the color of the progress indicator bar in the progress bar control. Returns the previous progress indicator bar color, or CLR_DEFAULT if the progress indicator bar color is the default color. clrBar COLORREF value that specifies the new progress indicator bar color. Specify the CLR_DEFAULT value to cause the progress bar to use its default progress indicator bar color.
所有和Progress Bar有关的消息。Progress Bar Control Messages This section includes information about the messages used with progress bar controls. PBM_DELTAPOS PBM_GETPOS PBM_GETRANGE PBM_SETBARCOLOR PBM_SETBKCOLOR PBM_SETPOS PBM_SETRANGE PBM_SETRANGE32 PBM_SETSTEP PBM_STEPIT
上面是个ACTIVEX 控件源码,你可以下来研究以下。
If ipfColor <> 0 Then Call SendMessage(ipProgBarHwnd, PBM_SETBARCOLOR, 0, ByVal ipfColor)
If ipbColor <> 0 Then Call SendMessage(ipProgBarHwnd, PBM_SETBKCOLOR, 0, ByVal ipbColor)End Sub
wParam = 0;
lParam = (LPARAM)(COLORREF)clrBar;Sets the color of the progress indicator bar in the progress bar control. Returns the previous progress indicator bar color, or CLR_DEFAULT if the progress indicator bar color is the default color.
clrBar
COLORREF value that specifies the new progress indicator bar color. Specify the CLR_DEFAULT value to cause the progress bar to use its default progress indicator bar color.
This section includes information about the messages used with progress bar controls. PBM_DELTAPOS
PBM_GETPOS
PBM_GETRANGE
PBM_SETBARCOLOR
PBM_SETBKCOLOR
PBM_SETPOS
PBM_SETRANGE
PBM_SETRANGE32
PBM_SETSTEP
PBM_STEPIT
就是根据时间改变height或width属性
就可以了