Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleUse API functions to change a ProgressBar's foreground and background colors
DescriptionThis 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.
KeywordsProgressBar, foreground, background, ForeColor, BackColor
CategoriesControls, 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
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated