📄 form1.frm
字号:
End
End
Begin VB.Menu mnuOpen
Caption = "99"
Index = 5
End
Begin VB.Menu mnuOpen
Caption = "88"
Index = 6
End
Begin VB.Menu mnuOpen
Caption = "77"
Index = 7
End
Begin VB.Menu mnuOpen
Caption = "66"
Index = 8
End
Begin VB.Menu mnuOpen
Caption = "55"
Index = 9
End
Begin VB.Menu mnuOpen
Caption = "44"
Index = 10
End
Begin VB.Menu mnuOpen
Caption = "33"
Index = 11
End
Begin VB.Menu mnuOpen
Caption = "22"
Index = 12
End
Begin VB.Menu mnuOpen
Caption = "11"
Index = 13
End
End
Begin VB.Menu mnuFile
Caption = "&Close"
Checked = -1 'True
Enabled = 0 'False
Index = 2
Shortcut = ^W
End
Begin VB.Menu mnuFile
Caption = "-"
Index = 3
End
Begin VB.Menu mnuFile
Caption = "Print..."
Index = 4
End
Begin VB.Menu mnuFile
Caption = "Print Preview"
Checked = -1 'True
Index = 5
End
Begin VB.Menu mnuFile
Caption = "-"
Index = 6
End
Begin VB.Menu mnuFile
Caption = "Exit Alt+F4"
Index = 7
End
End
Begin VB.Menu mnuMain
Caption = "&Edit"
Index = 1
Begin VB.Menu mnuEdit
Caption = "Undo"
Index = 0
Begin VB.Menu mnuUndo
Caption = "1111"
Index = 0
End
Begin VB.Menu mnuUndo
Caption = "2222"
Index = 1
End
End
Begin VB.Menu mnuEdit
Caption = "-"
Index = 1
End
Begin VB.Menu mnuEdit
Caption = "Cut"
Index = 2
Shortcut = ^X
End
Begin VB.Menu mnuEdit
Caption = "Copy"
Index = 3
Shortcut = ^C
End
Begin VB.Menu mnuEdit
Caption = "Paste"
Enabled = 0 'False
Index = 4
Shortcut = ^V
End
Begin VB.Menu mnuEdit
Caption = "-"
Index = 5
End
Begin VB.Menu mnuEdit
Caption = "Add menu"
Index = 6
End
Begin VB.Menu mnuEdit
Caption = "-"
Index = 7
Visible = 0 'False
End
End
Begin VB.Menu mnuMain
Caption = "&Icon size"
Index = 2
Begin VB.Menu mnuSize
Caption = "16x16 px"
Checked = -1 'True
Index = 0
End
Begin VB.Menu mnuSize
Caption = "20x20 px"
Index = 1
End
Begin VB.Menu mnuSize
Caption = "24x24 px"
Index = 2
End
Begin VB.Menu mnuSize
Caption = "28x28 px"
Index = 3
End
Begin VB.Menu mnuSize
Caption = "32x32 px"
Index = 4
End
End
Begin VB.Menu mnuMain
Caption = "popup"
Index = 3
Visible = 0 'False
Begin VB.Menu mnuPopup
Caption = "Properties"
Index = 0
End
Begin VB.Menu mnuPopup
Caption = "New"
Index = 1
Begin VB.Menu mnuPopupOpen
Caption = "Mail"
Index = 0
End
Begin VB.Menu mnuPopupOpen
Caption = "Appointement"
Index = 1
End
End
Begin VB.Menu mnuPopup
Caption = "-"
Index = 2
End
Begin VB.Menu mnuPopup
Caption = "Cancel"
Index = 3
End
End
Begin VB.Menu mnuTest
Caption = "&Test && Help"
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Enum UcsFileMenu
ucsFileNew = 0
ucsFileSave = 2
ucsFilePrintPreview = 5
ucsFileExit = 7
ucsEditUndo = 0
ucsEditCut = 2
ucsEditAddMenu = 6
ucsEditSep = 7
ucsMainPopup = 3
End Enum
Private Sub Form_Activate()
Call ctxHookMenu1.SetBitmap(mnuFile(ucsFileNew), Image1.Picture, &HC0C0C0)
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
PopupMenu mnuMain(ucsMainPopup), , , , mnuPopup(0)
End If
End Sub
Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Form_MouseUp Button, Shift, X, Y
End Sub
Private Sub mnuEdit_Click(Index As Integer)
Select Case Index
Case ucsEditUndo
Call ctxHookMenu1.SetBitmap(mnuFile(ucsFileSave), Image1.Picture, &HC0C0C0)
Case ucsEditCut
mnuFile(ucsFileNew).Caption = mnuFile(ucsFileNew).Caption & "1"
Case ucsEditAddMenu
mnuEdit(ucsEditSep).Visible = True
Load mnuEdit(mnuEdit.Count)
mnuEdit(mnuEdit.UBound).Caption = "Test - " & Timer
End Select
End Sub
Private Sub mnuFile_Click(Index As Integer)
Select Case Index
Case ucsFileNew
Dim f As New Form1
f.Show
mnuFile(ucsFileNew).Checked = Not mnuFile(ucsFileNew).Checked
Case ucsFileExit
Unload Me
Case ucsFilePrintPreview
mnuFile(ucsFilePrintPreview).Checked = Not mnuFile(ucsFilePrintPreview).Checked
End Select
End Sub
Private Sub mnuOpen_Click(Index As Integer)
If Index < 4 Then
MDIForm1.Show
End If
End Sub
Private Sub mnuSize_Click(Index As Integer)
Dim lI As Long
ctxHookMenu1.BitmapSize = 16 + Index * 4
For lI = mnuSize.LBound To mnuSize.UBound
mnuSize(lI).Checked = Index = lI
Next
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -