📄 ctrl_skinableform.ctl
字号:
.pic_CenterCaption.Width = .Width - .pic_LeftCaption.Width - .pic_RightCaption.Width
v_iCenterImgFrequency = Abs((.pic_CenterCaption.Width / Screen.TwipsPerPixelX) / 50)
If v_iCenterImgFrequency > 0 Then
For v_iLoop = 1 To v_iCenterImgFrequency
v_lRtn = BitBlt(.pic_CenterCaption.hdc, v_iLoop * 50, 0, 100, 48, .pic_CenterCaption.hdc, 0, 0, SRCCOPY)
Next v_iLoop
End If
.lbl_Caption.Width = .pic_CenterCaption.Width
.img_CloseBtn.Picture = .iml_Skin.ListImages(4).Picture
.img_CloseBtn.Left = .pic_RightCaption.Width - .img_CloseBtn.Width - 75
.img_CloseBtn.Top = 45
.img_RestoreBtn.Picture = .iml_Skin.ListImages(5).Picture
.img_RestoreBtn.Left = .pic_RightCaption.Width - .img_RestoreBtn.Width - .img_CloseBtn.Width - 75
.img_RestoreBtn.Top = 45
.img_MaximizeBtn.Picture = .iml_Skin.ListImages(6).Picture
.img_MaximizeBtn.Left = .pic_RightCaption.Width - .img_MaximizeBtn.Width - .img_CloseBtn.Width - 75
.img_MaximizeBtn.Top = 45
.img_MinimizeBtn.Picture = .iml_Skin.ListImages(7).Picture
.img_MinimizeBtn.Left = .pic_RightCaption.Width - .img_MinimizeBtn.Width - .img_MaximizeBtn.Width - .img_CloseBtn.Width - 75
.img_MinimizeBtn.Top = 45
.pic_Borders.Picture = .iml_Skin.ListImages(8).Picture
.pic_LeftBorder.Cls
.pic_LeftBorder.Top = .pic_LeftCaption.Height
.pic_LeftBorder.Height = .Height - .pic_LeftCaption.Height
.pic_RightBorder.Cls
.pic_RightBorder.Refresh
.pic_RightBorder.Left = .Width - 150
.pic_RightBorder.Top = .pic_RightCaption.Height
.pic_RightBorder.Height = m_Form.Height - .pic_RightCaption.Height
v_iCenterImgFrequency = Abs(((m_Form.Height - .pic_LeftCaption.Height) / Screen.TwipsPerPixelY) / 10)
If v_iCenterImgFrequency > 0 Then
For v_iLoop = 0 To v_iCenterImgFrequency - 1
v_lRtn = BitBlt(.pic_LeftBorder.hdc, 0, v_iLoop * 10, 10, 10, .pic_Borders.hdc, 0, 0, SRCCOPY)
v_lRtn = BitBlt(.pic_RightBorder.hdc, 0, v_iLoop * 10, 10, 10, .pic_Borders.hdc, 30, 0, SRCCOPY)
Next v_iLoop
End If
.pic_LeftBorder.Refresh
.pic_RightBorder.Refresh
.pic_DownBorder.Cls
.pic_DownBorder.Left = 0
.pic_DownBorder.Top = m_Form.Height - 150
.pic_DownBorder.Width = m_Form.Width
.pic_DownBorder.Height = 150
v_iCenterImgFrequency = Abs((m_Form.Width / Screen.TwipsPerPixelX) / 9)
If v_iCenterImgFrequency > 0 Then
For v_iLoop = 0 To v_iCenterImgFrequency
v_lRtn = BitBlt(.pic_DownBorder.hdc, v_iLoop * 9, 0, 9, 10, .pic_Borders.hdc, 20, 0, SRCCOPY)
Next v_iLoop
End If
v_lRtn = BitBlt(.pic_DownBorder.hdc, 0, 0, 10, 10, .pic_Borders.hdc, 10, 0, SRCCOPY)
v_lRtn = BitBlt(.pic_DownBorder.hdc, (m_Form.Width / Screen.TwipsPerPixelX) - 10, 0, 10, 10, .pic_Borders.hdc, 40, 0, SRCCOPY)
.pic_DownBorder.Refresh
.lbl_Caption.Top = CaptionTop
.lbl_Caption.ForeColor = CaptionColor
End With
End Sub
Public Sub Refresh()
Dim v_iCenterImgFrequency As Integer
Dim v_iLoop As Integer
Dim v_lhDC As Long
Dim v_lRtn As Long
With UserControl
.Width = v_oForm.Width
.Height = v_oForm.Height
v_oForm.BackColor = v_oBackColor
'v_oForm.Caption = Caption
'.img_Icon.Picture = v_oForm.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
.pic_CenterCaption.Width = .Width - .pic_LeftCaption.Width - .pic_RightCaption.Width
v_iCenterImgFrequency = Abs((.pic_CenterCaption.Width / Screen.TwipsPerPixelX) / 50)
If v_iCenterImgFrequency > 0 Then
For v_iLoop = 1 To v_iCenterImgFrequency
v_lRtn = BitBlt(.pic_CenterCaption.hdc, v_iLoop * 50, 0, 100, 48, .pic_CenterCaption.hdc, 0, 0, SRCCOPY)
Next v_iLoop
End If
.lbl_Caption.Width = .pic_CenterCaption.Width
'.img_CloseBtn.Picture = .iml_Skin.ListImages(4).Picture
.img_CloseBtn.Left = .pic_RightCaption.Width - .img_CloseBtn.Width - 75
.img_CloseBtn.Top = 45
'.img_RestoreBtn.Picture = .iml_Skin.ListImages(5).Picture
.img_RestoreBtn.Left = .pic_RightCaption.Width - .img_RestoreBtn.Width - .img_CloseBtn.Width - 75
.img_RestoreBtn.Top = 45
'.img_MaximizeBtn.Picture = .iml_Skin.ListImages(6).Picture
.img_MaximizeBtn.Left = .pic_RightCaption.Width - .img_MaximizeBtn.Width - .img_CloseBtn.Width - 75
.img_MaximizeBtn.Top = 45
'.img_MinimizeBtn.Picture = .iml_Skin.ListImages(7).Picture
.img_MinimizeBtn.Left = .pic_RightCaption.Width - .img_MinimizeBtn.Width - .img_MaximizeBtn.Width - .img_CloseBtn.Width - 75
.img_MinimizeBtn.Top = 45
'.pic_Borders.Picture = .iml_Skin.ListImages(8).Picture
'.pic_LeftBorder.Cls
.pic_LeftBorder.Top = .pic_LeftCaption.Height
.pic_LeftBorder.Height = .Height - .pic_LeftCaption.Height
'.pic_RightBorder.Cls
.pic_RightBorder.Refresh
.pic_RightBorder.Left = .Width - 150
.pic_RightBorder.Top = .pic_RightCaption.Height
.pic_RightBorder.Height = v_oForm.Height - .pic_RightCaption.Height
v_iCenterImgFrequency = Abs(((v_oForm.Height - .pic_LeftCaption.Height) / Screen.TwipsPerPixelY) / 10)
If v_iCenterImgFrequency > 0 Then
For v_iLoop = 0 To v_iCenterImgFrequency - 1
v_lRtn = BitBlt(.pic_LeftBorder.hdc, 0, v_iLoop * 10, 10, 10, .pic_Borders.hdc, 0, 0, SRCCOPY)
v_lRtn = BitBlt(.pic_RightBorder.hdc, 0, v_iLoop * 10, 10, 10, .pic_Borders.hdc, 30, 0, SRCCOPY)
Next v_iLoop
End If
.pic_LeftBorder.Refresh
.pic_RightBorder.Refresh
'.pic_DownBorder.Cls
.pic_DownBorder.Left = 0
.pic_DownBorder.Top = v_oForm.Height - 150
.pic_DownBorder.Width = v_oForm.Width
.pic_DownBorder.Height = 150
v_iCenterImgFrequency = Abs((v_oForm.Width / Screen.TwipsPerPixelX) / 9)
If v_iCenterImgFrequency > 0 Then
For v_iLoop = 0 To v_iCenterImgFrequency
v_lRtn = BitBlt(.pic_DownBorder.hdc, v_iLoop * 9, 0, 9, 10, .pic_Borders.hdc, 20, 0, SRCCOPY)
Next v_iLoop
End If
v_lRtn = BitBlt(.pic_DownBorder.hdc, 0, 0, 10, 10, .pic_Borders.hdc, 10, 0, SRCCOPY)
v_lRtn = BitBlt(.pic_DownBorder.hdc, (v_oForm.Width / Screen.TwipsPerPixelX) - 10, 0, 10, 10, .pic_Borders.hdc, 40, 0, SRCCOPY)
.pic_DownBorder.Refresh
.lbl_Caption.Top = CaptionTop
.lbl_Caption.ForeColor = CaptionColor
End With
End Sub
Public Property Get MaximizeBtn() As Boolean
Attribute MaximizeBtn.VB_ProcData.VB_Invoke_Property = "ppg_SFCustom"
MaximizeBtn = v_bMaximizeBtn
End Property
Public Property Let MaximizeBtn(ByVal m_MaximizeBtn As Boolean)
v_bMaximizeBtn = m_MaximizeBtn
PropertyChanged "Maximize"
End Property
Public Property Get MinimizeBtn() As Boolean
Attribute MinimizeBtn.VB_ProcData.VB_Invoke_Property = "ppg_SFCustom"
MinimizeBtn = v_bMinimizeBtn
End Property
Public Property Let MinimizeBtn(ByVal m_MinimizeBtn As Boolean)
v_bMinimizeBtn = m_MinimizeBtn
PropertyChanged "Minimize"
End Property
Public Property Get Caption() As String
Attribute Caption.VB_ProcData.VB_Invoke_Property = "ppg_SFCustom"
Caption = v_sCaption
End Property
Public Property Let Caption(ByVal m_Caption As String)
v_sCaption = m_Caption
PropertyChanged "Caption"
End Property
Public Property Get SkinPath() As String
Attribute SkinPath.VB_ProcData.VB_Invoke_Property = "ppg_SFCustom"
SkinPath = v_sSkinPath
End Property
Public Property Let SkinPath(ByVal m_SkinPath As String)
v_sSkinPath = m_SkinPath
PropertyChanged "SkinPath"
End Property
Public Property Get BackColor() As OLE_COLOR
BackColor = v_oBackColor
End Property
Public Property Let BackColor(ByVal m_BackColor As OLE_COLOR)
v_oBackColor = m_BackColor
PropertyChanged "BackColor"
End Property
Public Property Get ForeColor() As OLE_COLOR
ForeColor = v_oForeColor
End Property
Public Property Let ForeColor(ByVal m_ForeColor As OLE_COLOR)
v_oForeColor = m_ForeColor
PropertyChanged "ForeColor"
End Property
Public Property Get CaptionTop() As Integer
Attribute CaptionTop.VB_ProcData.VB_Invoke_Property = "ppg_SFCustom"
CaptionTop = v_iCaptionTop
End Property
Public Property Let CaptionTop(ByVal m_CaptionTop As Integer)
v_iCaptionTop = m_CaptionTop
PropertyChanged "CaptionTop"
End Property
Public Property Get CaptionColor() As OLE_COLOR
CaptionColor = v_oCaptionColor
End Property
Public Property Let CaptionColor(ByVal m_CaptionColor As OLE_COLOR)
v_oCaptionColor = m_CaptionColor
PropertyChanged "CaptionColor"
End Property
Public Property Get SystemIcon() As Boolean
Attribute SystemIcon.VB_ProcData.VB_Invoke_Property = "ppg_SFCustom"
SystemIcon = v_bSystemIcon
End Property
Public Property Let SystemIcon(ByVal m_SystemIcon As Boolean)
v_bSystemIcon = m_SystemIcon
PropertyChanged "SystemIcon"
End Property
Public Property Get AllowResizing() As Boolean
Attribute AllowResizing.VB_ProcData.VB_Invoke_Property = "ppg_SFCustom"
AllowResizing = v_bAllowResizing
End Property
Public Property Let AllowResizing(ByVal m_AllowResizing As Boolean)
v_bAllowResizing = m_AllowResizing
PropertyChanged "AllowResizing"
End Property
Private Sub img_CloseBtn_Click()
Unload Screen.ActiveForm
End Sub
Private Sub img_CloseBtn_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
UserControl.MousePointer = 0
End Sub
Private Sub img_Icon_Click()
RaiseEvent SysIconClick
End Sub
Private Sub img_MaximizeBtn_Click()
Screen.ActiveForm.WindowState = 2
UserControl.img_MaximizeBtn.Visible = False
UserControl.img_RestoreBtn.Visible = True
Call Refresh
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -