Change background/foreground color of Progressbar
Change background/foreground color of Progressbar. using SENDMESSAGE/win32API
AI
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Source Code
' -------------- module code -------------- 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 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) ' to change progressbarcolor Public Sub colortoprogress(prog As Long, bgr As Integer, bgg As Integer, bgb As Integer, fgr As Integer, fgg As Integer, fgb As Integer) SendMessage prog, PBM_SETBKCOLOR, 0, ByVal RGB(bgr, bgg, bgb) SendMessage prog, PBM_SETBARCOLOR, 0, ByVal RGB(fgr, fgg, fgb) End Sub ' -------------- form code -------------- Private Sub Form_Load() Me.ProgressBar1.Scrolling = ccScrollingSmooth Me.ProgressBar1.Min = 0 Me.ProgressBar1.Max = 100 colortoprogress Me.ProgressBar1.hwnd, 255, 255, 255, 0, 0, 0 Timer1.Interval = 10 Timer1.Enabled = True End Sub Private Sub Timer1_Timer() Me.ProgressBar1.visible = True If Me.ProgressBar1.Value = 100 Then Me.ProgressBar1.Value = 1 Me.ProgressBar1.Value = Me.ProgressBar1.Value + 1 End Sub
Original Comments (3)
Recovered from Wayback Machine