对于状态栏可以通过发送SB_SETBKCOLOR消息设置背景色 SB_SETBKCOLOR SB_SETBKCOLOR wParam = 0; lParam = (LPARAM)(COLORREF)clrBk;Sets the background color in a status bar. Returns the previous background color, or CLR_DEFAULT if the background color is the default color. clrBk COLORREF value that specifies the new background color. Specify the CLR_DEFAULT value to cause the status bar to use its default background color.
常量的值定义的不对: Option Explicit Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Const SB_SETBKCOLOR = &H2001Private Sub Command1_Click() Call SendMessage(StatusBar1.hwnd, SB_SETBKCOLOR, 0, ByVal vbGreen) End Sub
Option Explicit Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Const SB_SETBKCOLOR = &H2001Private Sub Command1_Click() Call SendMessage(StatusBar1.hwnd, SB_SETBKCOLOR, 0, ByVal vbRed) End Sub 没有任何问题,我用vbRed,vbBlue等等都试过了,还有只能用在6.0版本之中
SB_SETBKCOLOR
SB_SETBKCOLOR
wParam = 0;
lParam = (LPARAM)(COLORREF)clrBk;Sets the background color in a status bar. Returns the previous background color, or CLR_DEFAULT if the background color is the default color.
clrBk
COLORREF value that specifies the new background color. Specify the CLR_DEFAULT value to cause the status bar to use its default background color.
可参考:http://www.5ivb.net/down/21/5ivb_1112.asp
那SB_SETBKCOLOR的值是多少啊?在VB中没有它的预定义啊
Option Explicit
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const SB_SETBKCOLOR = &H2001Private Sub Command1_Click()
Call SendMessage(StatusBar1.hwnd, SB_SETBKCOLOR, 0, ByVal vbGreen)
End Sub
Private Const CCM_SETBKCOLOR = (CCM_FIRST + 1)
Private Const SB_SETBKCOLOR = CCM_SETBKCOLOR
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const SB_SETBKCOLOR = &H2001Private Sub Command1_Click()
Call SendMessage(StatusBar1.hwnd, SB_SETBKCOLOR, 0, ByVal vbRed)
End Sub
没有任何问题,我用vbRed,vbBlue等等都试过了,还有只能用在6.0版本之中