Toolbar looks ourselves (2)

xiaoxiao2021-03-05  20

Enter the topic, here is the code in the class, because mainly use the API, so there are many declarations, patience!

'Class module code: class name cToolbarOption ExplicitPrivate Const CDDS_ITEM As Long = & H10000Private Const CDDS_PREPAINT As Long = & H1Private Const CDDS_ITEMPREPAINT As Long = (CDDS_ITEM Or CDDS_PREPAINT) Private Const CDRF_SKIPDEFAULT As Long = & H4Private Const CDRF_NOTIFYITEMDRAW As Long = & H20Private Const CDIS_CHECKED As Long = & H8Private Const CDIS_DISABLED As Long = & H4Private Const CDIS_HOT As Long = & H40Private Const CDIS_SELECTED As Long = & H1Private Const GWL_WNDPROC = (-4) Private Const WM_USER As Long = & H400Private Const TB_GETBUTTONTEXTA As Long = (WM_USER 45) Private Const TB_GETIMAGELIST As Long = (WM_USER 49) Private Const TB_GETHOTIMAGELIST = (WM_USER 53) Private Const TB_GETDISABLEDIMAGELIST = (WM_USER 55) Private Const TB_GETBITMAP As Long = (WM_USER 44) Private Const TB_COMMANDTOINDEX As Long = (WM_USER 25) Private Const TB_GETBUTTON As Long = (WM_USER 23) PRIVATET TBSTYLE_LIST AS Long = & H1000Private const TBStyle_sep as long = & h1private const tbstyle_dropdown as long = & H8Private Const ILD_NORMAL As Long = & H0Private Const DST_TEXT = & H1 & Private Const DST_ICON As Long = & H3Private Const DSS_DISABLED = & H20 & Private Const CLR_NONE As Long = & HFFFFFFFFPrivate Const GWL_STYLE As Long = -16Private Const PS_SOLID As Long = 0Private Const TA_LEFT = 0Private Const TA_RIGHT = 2Private Const TA_CENTER = 6Private const bf_flat = & h4000private const bf_bottom = & h8private const bf_LEFT = & h1private const bf_right = & h4private const bf_top = &

H2Private Const BF_RECT = (BF_LEFT Or BF_TOP Or BF_RIGHT Or BF_BOTTOM) Private Const BDR_RAISEDOUTER = & H1Private Const BDR_RAISEDINNER = & H4Private Const BDR_SUNKENINNER = & H8Private Const BDR_SUNKENOUTER = & H2Private Const BDR_OUTER = & H3Private Const EDGE_ETCHED = (BDR_SUNKENOUTER Or BDR_RAISEDINNER) Private Const EDGE_RAISED = (BDR_RAISEDOUTER Or BDR_RAISEDINNER ) Private const Edge_sunken =

(BDR_SUNKENOUTER Or BDR_SUNKENINNER) Private Type BITMAP bmType As Long bmWidth As Long bmHeight As Long bmWidthBytes As Long bmPlanes As Integer bmBitsPixel As Integer bmBits As LongEnd TypePrivate Type ICONINFO fIcon As Long xHotspot As Long yHotspot As Long hbmMask As Long hbmColor As LongEnd TypePrivate Type RECT Left As Long Top As Long Right As Long Bottom As LongEnd TypePrivate Type pOINTL X As Long Y As LongEnd TypePrivate Type Size cx As Long cy As LongEnd TypePrivate Type LOGFONT lfHeight As Long lfWidth As Long lfEscapement As Long lfOrientation As Long lfWeight As Long lfItalic As Byte lfUnderline As Byte lfStrikeOut As Byte lfCharSet As Byte lfOutPrecision As Byte lfClipPrecision As Byte lfQuality As Byte lfPitchAndFamily As Byte lfFaceName As String * 32End TypePrivate Type TBBUTTON iBitmap As Long idCommand As Long fsState As Byte fsStyle As Byte bReserved ( 1) As Byte dwData As Long iString As LongEnd TypePrivate Type MemHdc hdc As Long Bmp As Long obm As LongEnd TypePrivate Type NMHDR hwndFrom As Long idfrom As Long code As LongEnd TypePrivate Type NMCUSTOMDRAW hdr As NMHDR dwDrawStage As Long hdc As Long rc As RECT dwItemSpec As Long uItemState As Long lItemlParam As LongEnd TypePrivate Type NMTBCUSTOMDRAW nmcd As NMCUSTOMDRAW hbrMonoDither As Long hbrLines As Long hpenLines As Long clrText As Long clrMark As Long clrTextHighlight As Long clrBtnFace As Long clrBtnHighlight As Long clrHighlightHotTrack As Long rcText As RECT nStringBkMode As Long nHLStringBkMode As LongEnd TypePrivate M_HWND As LongPrivate M_LngbackColor

As longprivate m_lngbrdstyle as longprivate m_lngtextColor As LongPrivate M_LNGTEXTHICOLOR As LongPrivate M_StrBkPicture As StringPrivate M_Lngbrdcolor As Long

Private mpicBk As StdPicturePrivate mlngImgList As LongPrivate mdcWhite As MemHdcPrivate mlngHotImgList As LongPrivate mlngDsbImgList As LongPrivate mlngBtnHiAlpha As LongPrivate mlngBtnDownAlpha As LongPrivate mlngIconWidth As LongPrivate mlngIconHeight As LongPrivate Font As LOGFONT 'message and Management Private Declare Function SendMessage Lib "user32.dll" Alias ​​"SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As LongPrivate Declare Function ShowWindow Lib "user32" Alias ​​"ShowWindowAsync" (ByVal hWnd As Long, ByVal nCmdShow As Long) As LongPrivate Declare Function GetWindowLong Lib "user32.dll" Alias ​​"GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As LongPrivate Declare Function SetWindowLong Lib "user32" Alias ​​"SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As LONGPRIVATE DECLARE FUNCTION GETCLASSNAME LIB "User32" Alias ​​"getclassname" (byval hwnd as long, byval lpclassname as string, byval nmaxcount as lo ng) As LongPrivate Declare Sub CopyMemory Lib "kernel32.dll" Alias ​​"RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long) 'GDI object class Private Declare Function CreateSolidBrush Lib "gdi32.dll" (ByVal crColor As Long ) As LongPrivate Declare Function CreatePen Lib "gdi32.dll" (ByVal nPenStyle As Long, ByVal nWidth As Long, ByVal crColor As Long) As LongPrivate Declare Function CreateFontIndirect Lib "gdi32" Alias ​​"CreateFontIndirectA" (lpLogFont As LOGFONT) As LongPrivate Declare Function SelectObject Lib "GDI32"

(ByVal hdc As Long, ByVal hObject As Long) As LongPrivate Declare Function DestroyIcon Lib "user32.dll" (ByVal hIcon As Long) As LongPrivate Declare Function DeleteObject Lib "gdi32.dll" (ByVal hObject As Long) As LongPrivate Declare Function GetIconInfo lib "user32" (ByVal hIcon As Long, piconinfo As ICONINFO) As LongPrivate Declare Function GetObj lib "gdi32" Alias ​​"GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As LongPrivate Declare Function CreatePatternBrush lib "gdi32 "(ByVal hBitmap As Long) As LongPrivate Declare Function CreateCompatibleDC Lib" gdi32 "(ByVal hdc As Long) As LongPrivate Declare Function CreateCompatibleBitmap Lib" gdi32 "(ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As LongPrivate Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As LongPrivate Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As LongPrivate Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hdc As Long) As Long ' Area, painting FIG, text-based Private Declare Function GetClientRect Lib "user32.dll" (ByVal hWnd As Long, lpRect As RECT) As LongPrivate Declare Function SetRect Lib "user32.dll" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As LongPrivate Declare Function FillRect Lib "user32.dll" (ByVal hdc As Long, lpRect As RECT, ByVal hBrush As Long) As LongPrivate Declare Function Polygon Lib "gdi32" (ByVal hdc As Long , LPPOINT AS POINTL, BYVAL NCOUNT AS Long) AS Longprivate Declare Function DrawEdge Lib "User32"

(ByVal hdc As Long, qrc As RECT, ByVal edge As Long, ByVal grfFlags As Long) As LongPrivate Declare Function FrameRect Lib "user32" (ByVal hdc As Long, lpRect As RECT, ByVal hBrush As Long) As LongPrivate Declare Function MoveToEx Lib "gdi32.dll" (Byval HDC As Long, Byval X as long, byval y as long, lppoint as any) As longprivate declare function lineto lib "gdi32.dll" (Byval HDC As Long, BYVAL X As Long, Byval Y AS Long) As LongPrivate Declare Function lstrlen Lib "kernel32" Alias ​​"lstrlenA" (ByVal lpString As String) As LongPrivate Declare Function GetTextExtentPoint32 Lib "gdi32" Alias ​​"GetTextExtentPoint32A" (ByVal hdc As Long, ByVal lpsz As String, ByVal cbString As Long, lpSize As Size) As LongPrivate Declare Function SetTextAlign Lib "gdi32" (ByVal hdc As Long, ByVal wFlags As Long) As LongPrivate Declare Function SetBkMode Lib "gdi32" (ByVal hdc As Long, ByVal nBkMode As Long) As LongPrivate Declare Function SetTextColor Lib "GDI32.DLL" (Byval HDC As Long, Byval Crcolor As Long ) As LongPrivate Declare Function TextOut Lib "gdi32" Alias ​​"TextOutA" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal lpString As String, ByVal nCount As Long) As LongPrivate Declare Function DrawState Lib "user32.dll "Alias" DrawStatea "(Byval Hbrush As Long, Byval LPDrawStateProc As Long, Byval Hico As Long, Byval WParam As Long, Byval N1 As Long, Byval N2 As Long, Byval N3 As Long, Byval N4 As Long, BYVAL N3 AS Long , BYVAL UN As long, as longprivate declare function alphablend lib "msimg32.dll"

转载请注明原文地址:https://www.9cbs.com/read-36759.html

New Post(0)