📄 isbutton.ctl
字号:
ByVal nBitCount As Long, _
lpBits As Any) As Long
Private Declare Function SelectObject _
Lib "gdi32" (ByVal hdc As Long, _
ByVal hObject As Long) As Long
Private Declare Function DeleteDC _
Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function DeleteObject _
Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function GetPixel _
Lib "gdi32.dll" (ByVal hdc As Long, _
ByVal X As Long, _
ByVal Y As Long) As Long
'Private Declare Function SetPixel _
Lib "gdi32.dll" (ByVal hdc As Long, _
ByVal x As Long, _
ByVal Y As Long, _
ByVal crColor As Long) As Long
Private Declare Function SetPixelV _
Lib "gdi32" (ByVal hdc As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal crColor As Long) As Long
Private Declare Function CreateWindowEx _
Lib "user32" _
Alias "CreateWindowExA" (ByVal dwExStyle As Long, _
ByVal lpClassName As String, _
ByVal lpWindowName As String, _
ByVal dwStyle As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
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 Declare Function DestroyWindow _
Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function SetWindowPos _
Lib "user32" (ByVal hWnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal cX As Long, _
ByVal cY As Long, _
ByVal wFlags As Long) As Long
'Private Declare Function GetWindowRect _
Lib "user32" (ByVal hwnd As Long, _
lpRect As RECT) As Long
Private Declare Function GetClientRect _
Lib "user32" (ByVal hWnd As Long, _
lpRect As RECT) As Long
Private Declare Function GetDC _
Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function GetSysColor _
Lib "user32" (ByVal nIndex As Long) As Long
Private Declare Function OleTranslateColor _
Lib "OLEPRO32.DLL" (ByVal OLE_COLOR As Long, _
ByVal HPALETTE As Long, _
pccolorref As Long) As Long
'Private Declare Function GetCursorPos _
Lib "user32" (lpPoint As POINT) As Long
Private Declare Function DrawEdge _
Lib "user32" (ByVal hdc As Long, _
qrc As RECT, _
ByVal edge As Long, _
ByVal grfFlags As Long) As Long
Private Declare Function MoveToEx _
Lib "gdi32" (ByVal hdc As Long, _
ByVal X As Long, _
ByVal Y As Long, _
lpPoint As Point) As Long
Private Declare Function LineTo _
Lib "gdi32" (ByVal hdc As Long, _
ByVal X As Long, _
ByVal Y As Long) As Long
'Private Declare Function DrawFocusRect _
Lib "user32" (ByVal hdc As Long, _
lpRect As RECT) As Long
'Private Declare Function DrawState _
Lib "user32" _
Alias "DrawStateA" (ByVal hdc As Long, _
ByVal hBrush As Long, _
ByVal lpDrawStateProc As Long, _
ByVal lParam As Long, _
ByVal wParam As Long, _
ByVal x As Long, _
ByVal Y As Long, _
ByVal cX As Long, _
ByVal cY As Long, ByVal fuFlags As Long) As Long
Private Declare Function CreateSolidBrush _
Lib "gdi32" (ByVal crColor As Long) As Long
'Private Declare Function GetCurrentThemeName _
Lib "uxtheme.dll" (ByVal pszThemeFileName As Long, _
ByVal dwMaxNameChars As Long, _
ByVal pszColorBuff As Long, _
ByVal cchMaxColorChars As Long, _
ByVal pszSizeBuff As Long, _
ByVal cchMaxSizeChars As Long) As Long
'Private Declare Function RegisterWindowMessage _
Lib "user32" _
Alias "RegisterWindowMessageA" (ByVal lpString As String) As Long
'Private Declare Function SystemParametersInfo _
Lib "user32" _
Alias "SystemParametersInfoA" (ByVal uAction As Long, _
ByVal uParam As Long, _
ByRef lpvParam As Long, _
ByVal fuWinIni As Long) As Long
Private Declare Function CreatePen _
Lib "gdi32" (ByVal nPenStyle As Long, _
ByVal nWidth As Long, _
ByVal crColor As Long) As Long
Private Declare Function FillRect _
Lib "user32" (ByVal hdc As Long, _
lpRect As RECT, _
ByVal hBrush As Long) As Long
'Private Declare Function GetActiveWindow _
Lib "user32" () As Long
'Private Declare Function WindowFromPoint _
Lib "user32" (ByVal xPoint As Long, _
ByVal yPoint As Long) As Long
Private Declare Function SetWindowRgn _
Lib "user32" (ByVal hWnd As Long, _
ByVal hRgn As Long, _
ByVal bRedraw As Boolean) As Long
'Private Declare Function CreateEllipticRgn _
Lib "gdi32" (ByVal X1 As Long, _
ByVal Y1 As Long, _
ByVal X2 As Long, _
ByVal Y2 As Long) As Long
Private Declare Function CreateRoundRectRgn _
Lib "gdi32" (ByVal X1 As Long, _
ByVal Y1 As Long, _
ByVal X2 As Long, _
ByVal Y2 As Long, _
ByVal X3 As Long, _
ByVal Y3 As Long) As Long
Private Declare Function CreatePolygonRgn _
Lib "gdi32" (lpPoint As Point, _
ByVal nCount As Long, _
ByVal nPolyFillMode As Long) As Long
'Private Declare Function CreatePolyPolygonRgn _
Lib "gdi32" (lpPoint As POINT, _
lpPolyCounts As Long, _
ByVal nCount As Long, _
ByVal nPolyFillMode As Long) As Long
Private Declare Function CreateRectRgn _
Lib "gdi32" (ByVal X1 As Long, _
ByVal Y1 As Long, _
ByVal X2 As Long, _
ByVal Y2 As Long) As Long
'Private Declare Function CombineRgn _
Lib "gdi32" (ByVal hDestRgn As Long, _
ByVal hSrcRgn1 As Long, _
ByVal hSrcRgn2 As Long, _
ByVal nCombineMode As Long) As Long
'Private Declare Function GetVersionEx _
Lib "kernel32" _
Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFOEX) As Long
Private Declare Function SetParent _
Lib "user32.dll" (ByVal hWndChild As Long, _
ByVal hWndNewParent As Long) As Long
Private Declare Function CreateIconIndirect _
Lib "user32" (piconinfo As ICONINFO) As Long
Private Declare Function ReleaseDC _
Lib "user32" (ByVal hWnd As Long, _
ByVal hdc As Long) As Long
Private Declare Function DrawIconEx _
Lib "user32" (ByVal hdc As Long, _
ByVal xLeft As Long, _
ByVal yTop As Long, _
ByVal hIcon As Long, _
ByVal cxWidth As Long, _
ByVal cyWidth As Long, _
ByVal istepIfAniCur As Long, _
ByVal hbrFlickerFreeDraw As Long, _
ByVal diFlags As Long) As Long
Private Declare Function DestroyIcon _
Lib "user32.dll" (ByVal hIcon As Long) As Long
Private Declare Function GetIconInfo _
Lib "user32.dll" (ByVal hIcon As Long, _
ByRef piconinfo As ICONINFO) As Long
Private Declare Function GetObjectAPI _
Lib "gdi32" _
Alias "GetObjectA" (ByVal hObject As Long, _
ByVal nCount As Long, _
lpObject As Any) As Long
Private Declare Function GetDIBits _
Lib "gdi32" (ByVal aHDC As Long, _
ByVal hBitmap As Long, _
ByVal nStartScan As Long, _
ByVal nNumScans As Long, _
lpBits As Any, _
lpbi As BITMAPINFO, _
ByVal wUsage As Long) As Long
Private Declare Function GetNearestColor _
Lib "gdi32" (ByVal hdc As Long, _
ByVal crColor As Long) As Long
Private Declare Function SetDIBitsToDevice _
Lib "gdi32" (ByVal hdc As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal dx As Long, _
ByVal dy As Long, _
ByVal SrcX As Long, _
ByVal SrcY As Long, _
ByVal Scan As Long, _
ByVal NumScans As Long, _
Bits As Any, _
BitsInfo As BITMAPINFO, _
ByVal wUsage As Long) As Long
'*************************************************************
'
' Private variables
'
'*************************************************************
Private m_bFocused As Boolean
Private m_bVisible As Boolean
Private m_iState As isState
Private m_iStyle As isbStyle
Private m_iNonThemeStyle As isbStyle
Private m_btnRect As RECT
Private m_txtRect As RECT
Private m_lRegion As Long
Private m_sCaption As String
Private m_CaptionAlign As isbAlign
Private m_IconAlign As isbAlign
Private m_Icon As StdPicture
Private m_Font As StdFont
Private m_IconSize As Long
Private m_bEnabled As Boolean
Private m_bShowFocus As Boolean
Private m_bUseCustomColors As Boolean
Private m_lBackColor As Long
Private m_lHighlightColor As Long
Private m_lFontColor As Long
Private m_lFontHighlightColor As Long
Private m_sToolTipText As String
Private m_sTooltiptitle As String
Private m_lToolTipIcon As ttIconType
Private m_lToolTipType As ttStyleEnum
Private m_lttBackColor As Long
Private m_lttForeColor As Long
Private m_lttCentered As Boolean
Private m_lttHwnd As Long
Private m_ButtonType As isbButtonType
Private m_Value As Boolean
Private m_MaskColor As Long
Private m_UseMaskColor As Boolean
Private m_bRoundedBordersByTheme As Boolean
Private lPrevStyle As Long
Private iStyleIconOffset As Long
'for subclass
Private sc_aSubData() As tSubData 'Subclass data array
Private bTrack As Boolean
Private bTrackUser32 As Boolean
Private bInCtrl As Boolean
'Auxiliar Variables
Dim lwFontAlign As Long
Dim lPrevButton As Long
Dim ttip As TOOLINFO
'*************************************************************
'
' Public Events
'
'*************************************************************
Public Event Click()
Public Event MouseEnter()
Public Event MouseLeave()
' Paul Caton Self Subclassed template
' http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=54117&lngWId=1
'======================================================================================================
'Subclass handler - MUST be the first Public routine in this file. That includes public properties also
Public Sub zSubclass_Proc(ByVal bBefore As Boolean, _
ByRef bHandled As Boolean, _
ByRef lReturn As Long, _
ByRef lng_hWnd As Long, _
ByRef uMsg As Long, _
ByRef wParam As Long, _
ByRef lParam As Long)
'Parameters:
'bBefore - Indicates whether the the message is being processed before or after the default handler - only really needed if a message is set to callback both before & after.
'bHandled - Set this variable to True in a 'before' callback to prevent the message being subsequently processed by the default handler... and if set, an 'after' callback
'lReturn - Set this variable as per your intentions and requirements, see the MSDN documentation for each individual message value.
'hWnd - The window handle
'uMsg - The message number
'wParam - Message related data
'lParam - Message related data
'Notes:
'If you really know what you're doing, it's possible to change the values of the
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -