求qq电脑管家按钮效果
不是那个 “立即体验“的按钮 是 上面的大按钮
大家帮帮忙,我想做这个高亮的效果。
是不是有这类的控件?
Codejock Xtreme SuitePro ActiveX 这个东西,能做出这效果吗?
实在不行,高手们给指点下,给条路,我自己做
谢谢了。
[解决办法]
看看这个
[解决办法]
高亮效果我搜藏过一个,不知道是不是你要的,那个电脑管家还要下载安装,麻烦。
'modCmdVista'描述:vista样式按钮,但是没有移到获得焦点'使用方法:'使用前得先将按钮样式设置成Graphical,然后再用下面代码:'Private Sub Form_Load()' Call Init(Me.hWnd)'End Sub''Private Sub Form_Unload(Cancel As Integer)' Call Terminate(Me.hWnd)'End SubOption Explicit'引用Win32Api'得到默认的窗口消息处理过程的地址需要的APIPrivate Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long'设置一个新的窗口消息处理过程的地址需要的APIPrivate Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long'给指定的窗口消息处理过程传递消息需要的APIPrivate Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long'内存拷贝Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)Const GWL_WNDPROC = (-4&)Dim PrevWndProc&Private Const WM_DESTROY = &H2Private Const WM_DRAWITEM = &H2BPrivate Const WM_MOUSEMOVE = &H200Private Type RECTLeft As LongTop As LongRight As LongBottom As LongEnd Type'WM_DRAWITEM需要处理的结构体Private Type DRAWITEMSTRUCTCtlType As LongCtlID As LongitemID As LongitemAction As LongitemState As LonghwndItem As Longhdc As LongrcItem As RECTitemData As LongEnd Type' Owner draw 常量Private Const ODT_BUTTON = 4' Owner draw 动作Private Const ODA_DRAWENTIRE = &H1Private Const ODA_SELECT = &H2Private Const ODA_FOCUS = &H4' Owner draw 状态Private Const ODS_SELECTED = &H1Private Const ODS_GRAYED = &H2Private Const ODS_DISABLED = &H4Private Const ODS_CHECKED = &H8Private Const ODS_FOCUS = &H10Private Const ODS_DEFAULT = &H20Private Const ODS_HOTLIGHT As Long = &H40'得到指定窗口的文本Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long'GDI相关API函数,重画Button时使用Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As LongPrivate Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As LongPrivate Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As LongPrivate Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long) As LongPrivate Declare Function SetPixelV Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long'色彩常量Const COLOR_SCROLLBAR = 0Const COLOR_BACKGROUND = 1Const COLOR_ACTIVECAPTION = 2Const COLOR_INACTIVECAPTION = 3Const COLOR_MENU = 4Const COLOR_WINDOW = 5Const COLOR_WINDOWFRAME = 6Const COLOR_MENUTEXT = 7Const COLOR_WINDOWTEXT = 8Const COLOR_CAPTIONTEXT = 9Const COLOR_ACTIVEBORDER = 10Const COLOR_INACTIVEBORDER = 11Const COLOR_APPWORKSPACE = 12Const COLOR_HIGHLIGHT = 13Const COLOR_HIGHLIGHTTEXT = 14Const COLOR_BTNFACE = 15Const COLOR_BTNSHADOW = 16Const COLOR_GRAYTEXT = 17Const COLOR_BTNTEXT = 18Const COLOR_INACTIVECAPTIONTEXT = 19Const COLOR_BTNHIGHLIGHT = 20Private Declare Function FillRect Lib "user32" (ByVal hdc As Long, lpRect As RECT, ByVal hBrush As Long) As LongPrivate Declare Function FrameRect Lib "user32" (ByVal hdc As Long, lpRect As RECT, ByVal hBrush As Long) As LongPrivate Declare Function CreatePen Lib "gdi32" (ByVal nPenStyle As Long, ByVal nWidth As Long, ByVal crColor As Long) As Long'画笔格式Const PS_SOLID = 0Const PS_DASH = 1 ' -------Const PS_DOT = 2 ' .......Const PS_DASHDOT = 3 ' _._._._Const PS_DASHDOTDOT = 4 ' _.._.._Const PS_NULL = 5Const PS_INSIDEFRAME = 6Const PS_USERSTYLE = 7Const PS_ALTERNATE = 8Const PS_STYLE_MASK = &HFPrivate Declare Function MoveToEx Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, lpPoint As POINTAPI) As LongPrivate Declare Function LineTo Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As LongPrivate Type POINTAPIx As Longy As LongEnd TypePrivate Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As LongPrivate Const DT_SINGLELINE = &H20Private Const DT_CENTER = &H1Private Const DT_VCENTER = &H4Private Declare Function SetTextColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As LongPrivate Declare Function SetBkMode Lib "gdi32" (ByVal hdc As Long, ByVal nBkMode As Long) As LongPrivate Const TRANSPARENT = 1Private PT As POINTAPI' – 声明结束 --Private Sub DrawButton(ByVal hWnd As Long, ByVal hdc As Long, Rct As RECT, ByVal nState As Long)Dim s As StringDim HBR As LongDim Hpen As Long'画文字时背景为透明状SetBkMode hdc, TRANSPARENT'得到Button的Captions = String$(255, 0)s = Left$(s, GetWindowText(hWnd, s, 255))If (nState And ODS_DISABLED) = ODS_DISABLED Then'根据Button的Enabled状态进行重画 Call DrawDISABLED(hdc, Rct, s) Exit SubEnd IfIf (nState And ODS_SELECTED) = ODS_SELECTED Then'按下Button时重画Call DrawSELECTED(hdc, Rct, s) Exit SubEnd IfIf (nState And ODS_FOCUS) = ODS_FOCUS Then'Button得到焦点时重画Call DrawFocus(hdc, Rct, s) Exit SubEnd If'普通状态Call DrawLostFocus(hdc, Rct, s)End SubSub DrawSELECTED(hdc As Long, Rct As RECT, s As String)Dim HBR As LongDim Hpen As LongDim BtnW As Long, BtnH As LongBtnW = Rct.Right - Rct.LeftBtnH = Rct.Bottom - Rct.Top '填充背景[过渡]色 HBR = CreateSolidBrush(16511713) SelectObject hdc, HBR Rct.Left = 2: Rct.Top = 2 Rct.Right = BtnW - 2: Rct.Bottom = Int((BtnH - 4) / 6 + 2) FillRect hdc, Rct, HBR DeleteObject HBR HBR = CreateSolidBrush(16445144) SelectObject hdc, HBR Rct.Left = 2: Rct.Top = Rct.Bottom Rct.Right = BtnW - 2: Rct.Bottom = Rct.Top + Int((BtnH - 4) / 6 + 2) FillRect hdc, Rct, HBR DeleteObject HBR HBR = CreateSolidBrush(16246729) SelectObject hdc, HBR Rct.Left = 2: Rct.Top = Rct.Bottom Rct.Right = BtnW - 2: Rct.Bottom = Rct.Top + Int((BtnH - 4) / 6 + 1) FillRect hdc, Rct, HBR DeleteObject HBR HBR = CreateSolidBrush(15716760) SelectObject hdc, HBR Rct.Left = 2: Rct.Top = Rct.Bottom Rct.Right = BtnW - 2: Rct.Bottom = Rct.Top + Int((BtnH - 4) / 6 + 0.5) FillRect hdc, Rct, HBR DeleteObject HBR HBR = CreateSolidBrush(15452812) SelectObject hdc, HBR Rct.Left = 2: Rct.Top = Rct.Bottom Rct.Right = BtnW - 2: Rct.Bottom = Rct.Top + Int((BtnH - 4) / 6 + 0.5) FillRect hdc, Rct, HBR DeleteObject HBR HBR = CreateSolidBrush(15057535) SelectObject hdc, HBR Rct.Left = 2: Rct.Top = Rct.Bottom Rct.Right = BtnW - 2: Rct.Bottom = BtnH - 2 FillRect hdc, Rct, HBR DeleteObject HBR '画外框 HBR = CreateSolidBrush(9134636) SelectObject hdc, HBR Rct.Left = 0: Rct.Top = 0: Rct.Right = BtnW: Rct.Bottom = BtnH FrameRect hdc, Rct, HBR DeleteObject HBR '外四角处理 SetPixelV hdc, 0, 0, GetSysColor(COLOR_BTNFACE): SetPixelV hdc, 1, 0, 7428409: SetPixelV hdc, 2, 0, 8806446 SetPixelV hdc, 0, 1, 7427635 SetPixelV hdc, 0, 2, 8806188 ' SetPixelV hdc, BtnW - 3, 0, 8806446: SetPixelV hdc, BtnW - 2, 0, 7428409: SetPixelV hdc, BtnW - 1, 0, GetSysColor(COLOR_BTNFACE) SetPixelV hdc, BtnW - 1, 1, 7427635 SetPixelV hdc, BtnW - 1, 2, 8806188 ' SetPixelV hdc, 0, BtnH - 3, 8937773 SetPixelV hdc, 0, BtnH - 2, 9203271 SetPixelV hdc, 0, BtnH - 1, GetSysColor(COLOR_BTNFACE): SetPixelV hdc, 1, BtnH - 1, 9663819: SetPixelV hdc, 2, BtnH - 1, 9200686 ' SetPixelV hdc, BtnW - 1, BtnH - 3, 8937773 SetPixelV hdc, BtnW - 1, BtnH - 2, 9203271 SetPixelV hdc, BtnW - 3, BtnH - 1, 9200686: SetPixelV hdc, BtnW - 2, BtnH - 1, 9663819: SetPixelV hdc, BtnW - 1, BtnH - 1, GetSysColor(COLOR_BTNFACE) '画内框 HBR = CreateSolidBrush(14011322) SelectObject hdc, HBR Rct.Left = 1: Rct.Top = 1: Rct.Right = BtnW - 1: Rct.Bottom = BtnH - 1 FrameRect hdc, Rct, HBR DeleteObject HBR Hpen = CreatePen(PS_SOLID, 1, 14332520) SelectObject hdc, Hpen MoveToEx hdc, 2, BtnH - 2, PT LineTo hdc, BtnW - 2, BtnH - 2 DeleteObject Hpen '内四角处理 SetPixelV hdc, 1, 1, 9070650: SetPixelV hdc, 2, 1, 11246982 SetPixelV hdc, 1, 2, 11246982: SetPixelV hdc, 2, 2, 14011322 ' SetPixelV hdc, BtnW - 3, 1, 12102549: SetPixelV hdc, BtnW - 2, 1, 9070650 SetPixelV hdc, BtnW - 3, 2, 14011322: SetPixelV hdc, BtnW - 2, 2, 12102549 ' SetPixelV hdc, 1, BtnH - 3, 11899477: SetPixelV hdc, 2, BtnH - 3, 14464365 SetPixelV hdc, 1, BtnH - 2, 9069615: SetPixelV hdc, 2, BtnH - 2, 13872227 ' SetPixelV hdc, BtnW - 3, BtnH - 3, 14464365: SetPixelV hdc, BtnW - 2, BtnH - 3, 11899477 SetPixelV hdc, BtnW - 3, BtnH - 2, 13872227: SetPixelV hdc, BtnW - 2, BtnH - 2, 9069615 '画阴影文字 Rct.Left = 0 Rct.Right = BtnW Rct.Bottom = BtnH - 1 Rct.Top = 1 SetTextColor hdc, vbBlack DrawText hdc, s, Len(s), Rct, DT_CENTER Or DT_SINGLELINE Or DT_VCENTEREnd Sub