📄 ctrl_skinableform.ctl
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.UserControl ctrl_SkinableForm
BackStyle = 0 '透明
ClientHeight = 750
ClientLeft = 0
ClientTop = 0
ClientWidth = 750
PropertyPages = "ctrl_SkinableForm.ctx":0000
ScaleHeight = 750
ScaleWidth = 750
ToolboxBitmap = "ctrl_SkinableForm.ctx":002F
Begin VB.PictureBox pic_LeftCaption
AutoRedraw = -1 'True
AutoSize = -1 'True
BorderStyle = 0 'None
Height = 720
Left = 0
ScaleHeight = 720
ScaleWidth = 1200
TabIndex = 7
Top = 840
Visible = 0 'False
Width = 1200
Begin VB.Image img_Icon
Height = 240
Left = 120
Stretch = -1 'True
Top = 90
Visible = 0 'False
Width = 240
End
End
Begin VB.PictureBox pic_DownBorder
AutoRedraw = -1 'True
BorderStyle = 0 'None
Height = 150
Left = 720
ScaleHeight = 150
ScaleWidth = 1215
TabIndex = 5
Top = 720
Visible = 0 'False
Width = 1215
End
Begin VB.PictureBox pic_RightBorder
AutoRedraw = -1 'True
AutoSize = -1 'True
BorderStyle = 0 'None
Height = 495
Left = 120
ScaleHeight = 495
ScaleWidth = 150
TabIndex = 4
Top = 1560
Visible = 0 'False
Width = 150
End
Begin VB.PictureBox pic_Borders
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 495
Left = 2040
ScaleHeight = 435
ScaleWidth = 1155
TabIndex = 3
Top = 720
Visible = 0 'False
Width = 1215
End
Begin VB.PictureBox pic_LeftBorder
AutoRedraw = -1 'True
AutoSize = -1 'True
BorderStyle = 0 'None
Height = 495
Left = 0
ScaleHeight = 495
ScaleWidth = 150
TabIndex = 2
Top = 1560
Visible = 0 'False
Width = 150
End
Begin VB.PictureBox pic_RightCaption
AutoRedraw = -1 'True
AutoSize = -1 'True
BorderStyle = 0 'None
Height = 720
Left = 2400
ScaleHeight = 720
ScaleWidth = 1440
TabIndex = 1
Top = 0
Visible = 0 'False
Width = 1440
Begin VB.Image img_MinimizeBtn
Height = 300
Left = 810
Top = 0
Width = 285
End
Begin VB.Image img_MaximizeBtn
Height = 300
Left = 540
Top = 0
Width = 285
End
Begin VB.Image img_RestoreBtn
Height = 300
Left = 270
Top = 0
Width = 285
End
Begin VB.Image img_CloseBtn
Height = 300
Left = 0
Top = 0
Width = 285
End
End
Begin VB.PictureBox pic_CenterCaption
AutoRedraw = -1 'True
AutoSize = -1 'True
BorderStyle = 0 'None
Height = 720
Left = 1200
ScaleHeight = 720
ScaleWidth = 1215
TabIndex = 0
Top = 0
Visible = 0 'False
Width = 1215
Begin VB.Label lbl_Caption
BackStyle = 0 'Transparent
Caption = "Caption"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 0
TabIndex = 6
Top = 0
Width = 555
End
End
Begin MSComctlLib.ImageList iml_Skin
Left = 3840
Top = 0
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
MaskColor = 12632256
_Version = 393216
End
Begin VB.Image img_Logo
Height = 750
Left = 0
Picture = "ctrl_SkinableForm.ctx":0341
Top = 0
Width = 750
End
End
Attribute VB_Name = "ctrl_SkinableForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "PropPageWizardRun" ,"Yes"
Option Explicit
Const MAX_TOOLTIP As Integer = 64
Const NIF_ICON = &H2
Const NIF_MESSAGE = &H1
Const NIF_TIP = &H4
Const NIM_ADD = &H0
Const NIM_DELETE = &H2
Const WM_MOUSEMOVE = &H200
Const WM_LBUTTONDOWN = &H201
Const WM_LBUTTONUP = &H202
Const WM_LBUTTONDBLCLK = &H203
Const WM_RBUTTONDOWN = &H204
Const WM_RBUTTONUP = &H205
Const WM_RBUTTONDBLCLK = &H206
Private Type NOTIFYICONDATA
cbSize As Long
hWnd As Long
uID As Long
uFlags As Long
uCallbackMessage As Long
hIcon As Long
szTip As String * MAX_TOOLTIP
End Type
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
Private Const SRCCOPY = &HCC0020
Const DefMaximizeBtn = 1
Const DefMinimizeBtn = 1
Const DefCaption = "Caption"
Const DefBackColor = 0
Const DefForeColor = 0
Const DefCaptionTop = 195
Const DefCaptionColor = 0
Const DefSystemIcon = 1
Const DefAllowResizing = 1
Dim nfIconData As NOTIFYICONDATA
Dim v_bMaximizeBtn As Boolean
Dim v_bMinimizeBtn As Boolean
Dim v_sCaption As String
Dim v_sSkinPath As String
Dim v_oBackColor As OLE_COLOR
Dim v_oForeColor As OLE_COLOR
Dim v_iCaptionTop As Integer
Dim v_oCaptionColor As OLE_COLOR
Dim v_bSystemIcon As Boolean
Dim v_bAllowResizing As Boolean
Dim v_iMouseX, v_iMouseY As Integer
Dim v_bResizing As Boolean
Dim v_oForm As Form
Event Click()
Attribute Click.VB_Description = "Occurs when the user presses and then releases a mouse button over an object."
Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Attribute MouseMove.VB_Description = "Occurs when the user moves the mouse."
Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Attribute MouseDown.VB_Description = "Occurs when the user presses the mouse button while an object has the focus."
Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Attribute MouseUp.VB_Description = "Occurs when the user releases the mouse button while an object has the focus."
Event SysIconClick()
Public Sub LoadSkin(m_Form As Form)
Dim v_iCenterImgFrequency As Integer
Dim v_iLoop As Integer
Dim v_lhDC As Long
Dim v_lRtn As Long
Set v_oForm = m_Form
With UserControl
.Width = m_Form.Width
.Height = m_Form.Height
m_Form.BackColor = v_oBackColor
m_Form.Caption = Caption
.img_Icon.Picture = m_Form.Icon
.pic_LeftCaption.Visible = True
.pic_CenterCaption.Visible = True
.pic_RightCaption.Visible = True
.pic_LeftBorder.Visible = True
.pic_RightBorder.Visible = True
.pic_DownBorder.Visible = True
.img_Logo.Visible = False
.iml_Skin.ListImages.Add 1, , LoadPicture(SkinPath & "\img_Caption_Left.bmp")
.iml_Skin.ListImages.Add 2, , LoadPicture(SkinPath & "\img_Caption_Center.bmp")
.iml_Skin.ListImages.Add 3, , LoadPicture(SkinPath & "\img_Caption_Right.bmp")
.iml_Skin.ListImages.Add 4, , LoadPicture(SkinPath & "\img_Button_Close.gif")
.iml_Skin.ListImages.Add 5, , LoadPicture(SkinPath & "\img_Button_Restore.gif")
.iml_Skin.ListImages.Add 6, , LoadPicture(SkinPath & "\img_Button_Maximize.gif")
.iml_Skin.ListImages.Add 7, , LoadPicture(SkinPath & "\img_Button_Minimize.gif")
.iml_Skin.ListImages.Add 8, , LoadPicture(SkinPath & "\img_Borders.bmp")
.pic_LeftCaption.Cls
.pic_LeftCaption.Picture = .iml_Skin.ListImages(1).Picture
.pic_LeftCaption.Refresh
.pic_LeftCaption.Top = 0
.pic_RightCaption.Cls
.pic_RightCaption.Picture = .iml_Skin.ListImages(3).Picture
.pic_RightCaption.Refresh
.pic_RightCaption.Left = .Width - .pic_RightCaption.Width
.pic_CenterCaption.Picture = .iml_Skin.ListImages(2).Picture
.pic_CenterCaption.Left = .pic_LeftCaption.Width
.pic_CenterCaption.Refresh
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -