📄 usercontrol1.ctl
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.UserControl UserControl1
ClientHeight = 435
ClientLeft = 0
ClientTop = 0
ClientWidth = 8760
ScaleHeight = 435
ScaleWidth = 8760
Begin MSComctlLib.ImageList ImageList1
Left = 2160
Top = 240
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 15
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 16
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "UserControl1.ctx":0000
Key = "New"
Object.Tag = "New"
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "UserControl1.ctx":0542
Key = "Save"
Object.Tag = "Save"
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "UserControl1.ctx":0BBC
Key = "Print"
Object.Tag = "Print"
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "UserControl1.ctx":10FE
Key = "Modify"
Object.Tag = "Modify"
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "UserControl1.ctx":120A
Key = "Delete"
Object.Tag = "Delete"
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "UserControl1.ctx":13A4
Key = "Cancel"
Object.Tag = "Cancel"
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "UserControl1.ctx":18E6
Key = "Open"
Object.Tag = "Open"
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "UserControl1.ctx":1E28
Key = "Redo"
Object.Tag = "Redo"
EndProperty
BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "UserControl1.ctx":236A
Key = "Cut"
Object.Tag = "Cut"
EndProperty
BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "UserControl1.ctx":28AC
Key = "Help"
Object.Tag = "Help"
EndProperty
BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "UserControl1.ctx":2DEE
Key = "Close"
Object.Tag = "Close"
EndProperty
BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "UserControl1.ctx":2EFA
Key = "Find"
Object.Tag = "Find"
EndProperty
BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "UserControl1.ctx":3012
Key = "Customer"
Object.Tag = "Customer"
EndProperty
BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "UserControl1.ctx":332C
Key = "Business"
Object.Tag = "Business"
EndProperty
BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "UserControl1.ctx":3CE6
Key = "Item"
Object.Tag = "Item"
EndProperty
BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "UserControl1.ctx":3E40
Key = "Upload"
Object.Tag = "Upload"
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 420
Left = 0
TabIndex = 0
Top = 0
Width = 8760
_ExtentX = 15452
_ExtentY = 741
ButtonWidth = 609
ButtonHeight = 582
AllowCustomize = 0 'False
Appearance = 1
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 16
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "New"
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Open"
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Find"
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Delete"
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Modify"
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Cut"
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Copy"
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Cancel"
EndProperty
BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Redo"
EndProperty
BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Save"
EndProperty
BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Print"
EndProperty
BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Close"
EndProperty
BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "customer"
EndProperty
BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "business"
EndProperty
BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "item"
EndProperty
BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Upload"
EndProperty
EndProperty
End
End
Attribute VB_Name = "UserControl1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Public Event ButtonClick(ByVal Button As MSComctlLib.Button)
Private bDisplayDefalutCaption As Boolean
Private Sub UserControl_Initialize()
Call iniToolBar
End Sub
Public Sub iniToolBar()
On Error Resume Next
Dim i As Long
Dim Tmpobj1 As ListImage
Dim Tmpobj2 As MSComctlLib.Button
Set Toolbar1.ImageList = ImageList1
For Each Tmpobj2 In Toolbar1.Buttons
Tmpobj2.Key = LCase(Tmpobj2.Key)
For Each Tmpobj1 In ImageList1.ListImages
Tmpobj1.Key = LCase(Tmpobj1.Key)
If Tmpobj1.Key = Tmpobj2.Key Then
Tmpobj2.Image = Tmpobj1.Key
Exit For
End If
Next
Next
With Toolbar1
For i = 1 To .Buttons.Count
.Buttons(i).Visible = False
Next i
End With
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
RaiseEvent ButtonClick(Button)
End Sub
Public Function DisplayButton(pkey As String, Optional sTipText As String = "", Optional pEnabled As Boolean = True, _
Optional pStyle As ButtonStyleConstants = tbrDefault, Optional sCaption, Optional pVisible As Boolean = True) As Boolean
On Error GoTo ErrH
Dim tButton As MSComctlLib.Button
For Each tButton In Toolbar1.Buttons
If LCase(tButton.Key) = LCase(pkey) Then
tButton.Visible = pVisible
If pStyle <> tbrDefault And pStyle <> tButton.Style Then
tButton.Style = pStyle
End If
tButton.ToolTipText = sTipText
If IsMissing(sCaption) And bDisplayDefalutCaption Then
tButton.Caption = ImageList1.ListImages(LCase(pkey)).Tag
Else
tButton.Caption = sCaption
End If
tButton.Enabled = pEnabled
DisplayButton = True
Exit Function
End If
Next tButton
Exit Function
ErrH:
Debug.Print "Error:" & err.Description & " From cToolBar"
End Function
'Private Sub UserControl_Resize()
'On Error Resume Next
' UserControl.Width = UserControl.Parent.Width
'End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -