VBGood网站全文搜索 Google

搜索VBGood全站网页(全文搜索)
首页 - 经验之谈 - 取得和设置系统颜色
发表评论(0)作者:, 平台:, 阅读:8299, 日期:2000-03-12
取得和设置系统颜色

声明:

Public Const COLOR_SCROLLBAR = 0 '滚动条

Public Const COLOR_BACKGROUND = 1 '桌面背景

Public Const COLOR_ACTIVECAPTION = 2 '活动窗口标题

Public Const COLOR_INACTIVECAPTION = 3 '非活动窗口标题

Public Const COLOR_MENU = 4 '菜单

Public Const COLOR_WINDOW = 5 '窗口背景

Public Const COLOR_WINDOWFRAME = 6 '窗口框

Public Const COLOR_MENUTEXT = 7 '窗口文字

Public Const COLOR_WINDOWTEXT = 8 '3D 阴影 (Win95)

Public Const COLOR_CAPTIONTEXT = 9 '标题文字

Public Const COLOR_ACTIVEBORDER = 10 '活动窗口边框

Public Const COLOR_INACTIVEBORDER = 11 '非活动窗口边框

Public Const COLOR_APPWORKSPACE = 12 'MDI 窗口背景

Public Const COLOR_HIGHLIGHT = 13 '选择条背景

Public Const COLOR_HIGHLIGHTTEXT = 14 '选择条文字

Public Const COLOR_BTNFACE = 15 '按钮

Public Const COLOR_BTNSHADOW = 16 '3D 按钮阴影

Public Const COLOR_GRAYTEXT = 17 '灰度文字

Public Const COLOR_BTNTEXT = 18 '按钮文字

Public Const COLOR_INACTIVECAPTIONTEXT = 19 '非活动窗口文字

Public Const COLOR_BTNHIGHLIGHT = 20 '3D 选择按钮


Declare Function SetSysColors Lib "user32" Alias "SetSysColors" (ByVal

nChanges As Long, lpSysColor As Long, lpColorValues As Long) As Long

Declare Function GetSysColor Lib "user32" Alias "GetSysColor" (ByVal

nIndex As Long) As Long

使用:

i =GetSysColors(COLOR_ACTIVECAPTION)

'i 是 RGB 值

i = SetSysColors(1, COLOR_ACTIVECAPTION, RGB(255,0,0))

'把标题设置为红色