代碼:
'進度條顏色
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const PBM_SETBARCOLOR As Long = &H409
Private Sub Form_Load()
'進度條顏色設定
Call SendMessageLong(ProgressBar1(0).hWnd, PBM_SETBARCOLOR, 0&, ByVal 49152) '綠色
Call SendMessageLong(ProgressBar1(1).hWnd, PBM_SETBARCOLOR, 0&, ByVal 255) '紅色
Call SendMessageLong(ProgressBar1(2).hWnd, PBM_SETBARCOLOR, 0&, ByVal 16512) '茶色
Call SendMessageLong(ProgressBar1(3).hWnd, PBM_SETBARCOLOR, 0&, ByVal 33023) '橙黃色
Call SendMessageLong(ProgressBar1(4).hWnd, PBM_SETBARCOLOR, 0&, ByVal 16711680) '藍色
End Sub