⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 菜单_动态f.frm

📁 <VB数理统计实用算法>书中的算法源程序
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Appearance      =   0  'Flat
   BackColor       =   &H80000005&
   Caption         =   "动态菜单"
   ClientHeight    =   3090
   ClientLeft      =   165
   ClientTop       =   855
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3090
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.Menu mnuAPP 
      Caption         =   "可执行文件"
      Begin VB.Menu mnuEXE 
         Caption         =   "待执行文件"
         Begin VB.Menu mnuEXEfile 
            Caption         =   ""
            Index           =   0
            Visible         =   0   'False
         End
         Begin VB.Menu mnuEXEfile 
            Caption         =   "项目1"
            Index           =   1
         End
         Begin VB.Menu mnuEXEfile 
            Caption         =   "项目2"
            Index           =   2
            Visible         =   0   'False
         End
         Begin VB.Menu mnuEXEfile 
            Caption         =   "项目3"
            Index           =   3
            Visible         =   0   'False
         End
         Begin VB.Menu mnuEXEfile 
            Caption         =   "项目4"
            Index           =   4
            Visible         =   0   'False
         End
         Begin VB.Menu mnuEXEfile 
            Caption         =   "项目5"
            Index           =   5
            Visible         =   0   'False
         End
      End
      Begin VB.Menu mnuADD 
         Caption         =   "增加待执行文件"
         Begin VB.Menu mnuADDfile 
            Caption         =   ""
            Index           =   0
            Visible         =   0   'False
         End
         Begin VB.Menu mnuADDfile 
            Caption         =   "项目1"
            Index           =   1
            Visible         =   0   'False
         End
         Begin VB.Menu mnuADDfile 
            Caption         =   "项目2"
            Index           =   2
         End
         Begin VB.Menu mnuADDfile 
            Caption         =   "项目3"
            Index           =   3
         End
         Begin VB.Menu mnuADDfile 
            Caption         =   "项目4"
            Index           =   4
         End
         Begin VB.Menu mnuADDfile 
            Caption         =   "项目5"
            Index           =   5
         End
      End
      Begin VB.Menu mnuDEL 
         Caption         =   "删除待执行文件"
         Begin VB.Menu mnuDELfile 
            Caption         =   ""
            Index           =   0
            Visible         =   0   'False
         End
         Begin VB.Menu mnuDELfile 
            Caption         =   "项目1"
            Index           =   1
         End
         Begin VB.Menu mnuDELfile 
            Caption         =   "项目2"
            Index           =   2
            Visible         =   0   'False
         End
         Begin VB.Menu mnuDELfile 
            Caption         =   "项目3"
            Index           =   3
            Visible         =   0   'False
         End
         Begin VB.Menu mnuDELfile 
            Caption         =   "项目4"
            Index           =   4
            Visible         =   0   'False
         End
         Begin VB.Menu mnuDELfile 
            Caption         =   "项目5"
            Index           =   5
            Visible         =   0   'False
         End
      End
   End
   Begin VB.Menu mnuExit 
      Caption         =   "退出"
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim intC As Integer
Const filenumber = 5        '项目个数

Private Sub Form_Load()
    intC = filenumber
End Sub

Private Sub mnuADDfile_Click(Index As Integer)
'从mnuADDfile菜单数组中移走项目,添加到mnuEXEfile数组中
    If intC <= 2 Then
        MsgBox "必须保留一个项目,不能再移走!"
        Exit Sub
    End If
    mnuDELfile(Index).Visible = True
    mnuEXEfile(Index).Visible = True
    mnuADDfile(Index).Visible = False
    intC = intC - 1
End Sub

Private Sub mnuDELfile_Click(Index As Integer)
'从mnuEXEfile数组中移走项目,送回mnuADDfile菜单数组
    If intC >= filenumber Then
        MsgBox "只有一个待执行文件,不能再删除!"
        Exit Sub
    End If
    mnuDELfile(Index).Visible = False
    mnuEXEfile(Index).Visible = False
    mnuADDfile(Index).Visible = True
    intC = intC + 1
End Sub

Private Sub mnuEXEfile_Click(Index As Integer)
'执行项目
    Select Case Index
        Case 1
            Debug.Print "执行项目1"
        Case 2
            Debug.Print "执行项目2"
        Case 3
            Debug.Print "执行项目3"
        Case 4
            Debug.Print "执行项目4"
        Case 5
            Debug.Print "执行项目5"
    End Select
End Sub

Private Sub mnuExit_Click()
    Unload Me
    End
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -