|
|
Title | Use API functions to change a ProgressBar's foreground and background colors |
Description | This example shows how to use API functions to change a ProgressBar's foreground and background colors in Visual Basic 6. It uses the SendMessage API function to send the PBM_SETBKCOLOR and PBM_SETBARCOLOR messages to the control. |
Keywords | ProgressBar, foreground, background, ForeColor, BackColor |
Categories | Controls, API, Graphics |
|
|
Thanks to Dipak Auddy.
To set the control's background color, use the SendMessage API function to send the control the PBM_SETBKCOLOR message together with the color. To set the foreground color, send the PBM_SETBARCOLOR message.
|
|
Public Sub SetPBackColor(ByVal hwndProgBar As Long, _
Optional ByVal color As Long = vbWhite)
Call SendMessage(hwndProgBar, PBM_SETBKCOLOR, 0&, ByVal _
color)
End Sub
Public Sub SetPForeColor(ByVal hwndProgBar As Long, _
Optional ByVal color As Long = vbGreen)
Call SendMessage(hwndProgBar, PBM_SETBARCOLOR, 0&, _
ByVal color)
End Sub
|
|
|
|
|
|