📄 isbutton.ctl
字号:
VERSION 5.00
Begin VB.UserControl isButton
AutoRedraw = -1 'True
BackColor = &H00FFFFFF&
ClientHeight = 1455
ClientLeft = 0
ClientTop = 0
ClientWidth = 3435
DefaultCancel = -1 'True
BeginProperty Font
Name = "Verdana"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
KeyPreview = -1 'True
ScaleHeight = 97
ScaleMode = 3 'Pixel
ScaleWidth = 229
ToolboxBitmap = "isButton.ctx":0000
Begin VB.PictureBox m_About
BorderStyle = 0 'None
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2175
Left = 7440
ScaleHeight = 2175
ScaleWidth = 5655
TabIndex = 0
TabStop = 0 'False
Top = 6240
Width = 5655
End
End
Attribute VB_Name = "isButton"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'*************************************************************
'
' Control Name: isButton
'
' Author: Fred.cpp
' fred_cpp@gmail.com
'
' Page: http://mx.geocities.com/fred_cpp/
'
' Current
' Version: 3.6.2
'
' Description: Multy Style Command Button. Made from scratch,
' API drawn.
' I started this project almost 5 years ago, I've
' learned a lot since then, I think this version
' Is the first one that can be used In real world,
' I've keep this control for my own use for a
' long Time, But I've used It for personal
' projects, The only one public release was here:
' http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=51271&lngWId=1
' I Used It here cuz there was not too much to
' show then. Afther some months I feel like I
' could make the final Version, So Here I am.
' I hope you like It And If you find It useful
' please vote, leave comments and suggestions,
' Everything Is wellcome.
' Best Regards.
'
' Started on: 6-6-2004
'
' 2004-12-6
' Added Soft, Flat, java and Office XP Style
'
' 2004-18-6
' Added Windows XP style
'
' 2004-20-6
' Enhanced Office XP Style
'
' 2004-2-7
' Code Clean Up. Removed Timer, Now Uses the
' Paul Caton's self subclaser
'
' 2004-3-7
' Added Windows Themed Style
'
' 2004-4-7
' Added Galaxy style
'
' 2004-7-7
' Added Enabled/ShowFocus and Custom Colors
'
' 2004-8-7
' Added Plastik Style
'
' 2004-14-7
' Added Keramik Style
'
' 2004-15-7
' Added Multyple styles for Tooltips!
'
' 2004-19-7
' Added Custom WinXP Colors, Disabled State
' for the WinXP style(Normal and custom colors)
'
' 2004-20-7
' Added Mac OSX Style
'
' 2004-24-7
' Keramik Rewritten from scratch
'
' 2004-3-9
' Afther some weeks of inactivity added disabled state for
' plastik and keramik styles
'
' 2004-6-9
' Added a nice About box without a extra form!
' Also some corrections to the MAc OSX Style, But still
' needs more work.
'
' 2004-7-9
' PSC downloads are down. The post was deleted when I tried
' to update. I'm trying to make some improvements to the
' MAc OSX Style, but Nothing too important. just a bugfix
' with the disabled state.
'
' 2004-8-9
' Added font property, also tooltips info is not reseted
' each run. Thanks to the comments of the PSC users I have
' lot of things to improve!
'
' 2004-10-9
' OK, Lot, I mean LOT of suggestions, I would love to be at
' school when I had enought time to code (And I was young
' and was able to sleep one or two hours per day=( )
'
' 2004-12-9
' added font and small offsets for each button style. Also
' Enum names are fixed.
'
' 2004-15-9
' Version 3.0 The last one. added CheckBox Type and value
' property. maybe some Other smal fixes will be made
' soon...maybe.
' Have fun
'
' 2005-27-6
' Version 3.2 The previous was not the last one...
' 3.1 was ActiveX version, this one is usercontrol again.
' A Lot of Bugfixes. Tooltips now are not duplicated (also,
' some memory leaks fixed)
'
' 2005-28-6
' Version 3.3
' Added grayscaled icons for disabled icons
' Also fixed textgrayed when Icon was over the text.
' Thanks to Dennis (dvrdsr)
'
' 2005-1-7
' Version 3.4 Added grayscaled for BMP's when disabled
' (used a Different method). Tooltips bug Fixed forever
' (I really really hope so) Trying to implement Default
' And Cancel properties, but VB not cooperating :)
' some help?
'
' 2005-7-4
' Version: 3.4.1 Fixed Black Icons when using BMP's,
' Removed pMask (Thanks to teee_eeee), Added CustomRegion
' Support by Theme (Thanks to Dana Seaman)
'
' 2005-7-5
' Version 3.4.2 Code Clean Up and Now Working Default and
' Cancel properties, Error Handling in all routines, fixed
' Keyboard events (Done by Aldo Vargas at: 7/4/2005-15:59:11)
'
' 2005-7-5
' Version 3.5.0 Multiline Caption Added. Corrected Java Rects
' Added Custom Offset for text and Icons for each Style
'
' 2005-7-20
' Version 3.5.1 Added RightToLeft property (Still testing)
'
' 2005-7-28
' Version 3.6.0 Fixed CaptionAlign, Added Space Bar Support
' (Thanks to Jiri Novotny)
' Now hover button doesn't bring to front the parent form :)
'
' 2005-7-29
' Version 3.6.1 Code Clean up! RightToLeft fixed?
'
' 2005-9-15
' Version 3.6.2 Fast clicks result in a single click, even
' when the clicks are drawn, no message was fired. fixed.
'
'
Option Explicit
'*************************************************************
'
' Control Version:
'
Private Const strCurrentVersion = "3.6.2"
'**************************************
'*************************************************************
'
' Private Constants
'
'**************************************
'Auxiliar Constants
Private Const COLOR_BTNFACE As Long = 15
Private Const COLOR_BTNSHADOW As Long = 16
Private Const COLOR_BTNTEXT As Long = 18
Private Const COLOR_HIGHLIGHT As Long = 13
Private Const COLOR_WINDOW As Long = 5
Private Const COLOR_INFOTEXT As Long = 23
Private Const COLOR_INFOBK As Long = 24
Private Const BDR_RAISEDOUTER As Long = &H1
Private Const BDR_SUNKENOUTER As Long = &H2
Private Const BDR_RAISEDINNER As Long = &H4
Private Const BDR_SUNKENINNER As Long = &H8
Private Const EDGE_RAISED = (BDR_RAISEDOUTER Or BDR_RAISEDINNER)
Private Const EDGE_SUNKEN = (BDR_SUNKENOUTER Or BDR_SUNKENINNER)
Private Const BF_LEFT As Long = &H1
Private Const BF_TOP As Long = &H2
Private Const BF_RIGHT As Long = &H4
Private Const BF_BOTTOM As Long = &H8
Private Const BF_RECT As Long = (BF_LEFT Or BF_TOP Or BF_RIGHT Or BF_BOTTOM)
'Windows Messages
Private Const WM_MOUSEMOVE As Long = &H200
Private Const WM_MOUSELEAVE As Long = &H2A3
Private Const WM_THEMECHANGED As Long = &H31A
Private Const WM_SYSCOLORCHANGE As Long = &H15
Private Const WM_USER As Long = &H400
Private Const GWL_STYLE As Long = -16
Private Const WS_CAPTION As Long = &HC00000
Private Const WS_THICKFRAME As Long = &H40000
Private Const WS_MINIMIZEBOX As Long = &H20000
Private Const SWP_REFRESH As Long = (&H1 Or &H2 Or &H4 Or &H20)
Private Const SWP_NOACTIVATE As Long = &H10
Private Const SWP_NOMOVE As Long = &H2
Private Const SWP_NOSIZE As Long = &H1
Private Const SWP_SHOWWINDOW As Long = &H40
Private Const hWnd_TOPMOST As Long = -&H1
Private Const CW_USEDEFAULT As Long = &H80000000
'Constants for nPolyFillMode in CreatePolygonRgn y CreatePolyPolygonRgn:
Private Const ALTERNATE As Long = 1
''Tooltip Window Constants
Private Const TTS_NOPREFIX As Long = &H2
'Private Const TTF_TRANSPARENT As Long = &H100
Private Const TTF_CENTERTIP As Long = &H2
Private Const TTM_ADDTOOLA As Long = (WM_USER + 4)
Private Const TTM_DELTOOLA As Long = (WM_USER + 5)
Private Const TTM_SETTIPBKCOLOR As Long = (WM_USER + 19)
Private Const TTM_SETTIPTEXTCOLOR As Long = (WM_USER + 20)
Private Const TTM_SETTITLE As Long = (WM_USER + 32)
Private Const TTM_DELTOOLW As Long = (WM_USER + 51)
Private Const TTM_ADDTOOLW As Long = (WM_USER + 50)
Private Const TTM_SETTITLEW As Long = (WM_USER + 33)
Private Const TTS_BALLOON As Long = &H40
Private Const TTS_ALWAYSTIP As Long = &H1
Private Const TTF_SUBCLASS As Long = &H10
Private Const TOOLTIPS_CLASSA As String = "tooltips_class32"
'==================================================================================================
'Subclasser declarations
Private Const ALL_MESSAGES As Long = -1 'All messages added or deleted
Private Const GMEM_FIXED As Long = 0 'Fixed memory GlobalAlloc flag
Private Const GWL_WNDPROC As Long = -4 'Get/SetWindow offset to the WndProc procedure address
Private Const PATCH_04 As Long = 88 'Table B (before) address patch offset
Private Const PATCH_05 As Long = 93 'Table B (before) entry count patch offset
Private Const PATCH_08 As Long = 132 'Table A (after) address patch offset
Private Const PATCH_09 As Long = 137 'Table A (after) entry count patch offset
'==================================================================================================
'*************************************************************
'
' Required Type Definitions
'
'*************************************************************
Private Type POINT
X As Long
Y As Long
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type tSubData 'Subclass data type
hWnd As Long 'Handle of the window being subclassed
nAddrSub As Long 'The address of our new WndProc (allocated memory).
nAddrOrig As Long 'The address of the pre-existing WndProc
nMsgCntA As Long 'Msg after table entry count
nMsgCntB As Long 'Msg before table entry count
aMsgTblA() As Long 'Msg after table array
aMsgTblB() As Long 'Msg Before table array
End Type
''Tooltip Window Types
Private Type TOOLINFO
lSize As Long
lFlags As Long
lHwnd As Long
lId As Long
lpRect As RECT
hInstance As Long
lpStr As String
lParam As Long
End Type
Enum isbStyle 'Styles
[isbNormal] = &H0
[isbSoft] = &H1
[isbFlat] = &H2
[isbJava] = &H3
[isbOfficeXP] = &H4
[isbWindowsXP] = &H5
[isbWindowsTheme] = &H6
[isbPlastik] = &H7
[isbGalaxy] = &H8
[isbKeramik] = &H9
[isbMacOSX] = &HA
End Enum
Enum isbButtonType
isbButton = &H0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -