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

📄 main.frm

📁 在开发图纸管理软件时
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.MDIForm main 
   BackColor       =   &H8000000C&
   Caption         =   "带历史信息的菜单"
   ClientHeight    =   5265
   ClientLeft      =   165
   ClientTop       =   450
   ClientWidth     =   8625
   Icon            =   "main.frx":0000
   LinkTopic       =   "MDIForm1"
   StartUpPosition =   1  '所有者中心
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   1050
      Top             =   2415
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.Menu file 
      Caption         =   "文件"
      Begin VB.Menu open 
         Caption         =   "打开"
      End
      Begin VB.Menu close 
         Caption         =   "关闭所有"
      End
      Begin VB.Menu mnufilelist 
         Caption         =   "-"
         Index           =   0
      End
      Begin VB.Menu l 
         Caption         =   "-"
      End
      Begin VB.Menu exit 
         Caption         =   "退出"
      End
   End
End
Attribute VB_Name = "main"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim main As New main_frm
Public max_index As Integer
Public myindex As Integer
Private Sub close_Click()
  On Error Resume Next
'循环语句
  For Each main In Forms
    If main.MDIChild = True Then
       Unload main
    End If
  Next
  
  Dim FNum As Integer
  Dim strfilename As String
  Dim i As Integer
  
  FNum = FreeFile
  strfilename = App.Path & "\cdxx.ini"
  If Dir(strfilename) <> "" Then Kill strfilename
  Open strfilename For Output As #FNum
       For i = 1 To mnufilelist.Count - 1
           Print #FNum, mnufilelist(i).Caption
       Next
  Close #FNum
  Exit Sub
End Sub
Private Sub MDIForm_Load()
  Dim file As Long
  Dim mystring As String
  Dim s As String
  Dim strfilename As String
  strfilename = App.Path & "\cdxx.ini"
  file = FreeFile()
  On Error Resume Next
  Open strfilename For Input As #file   '打开文件菜单列表
       Do While Not EOF(file)
          Line Input #file, mystring
          If mystring <> "" Then
             max_index = max_index + 1
             Load mnufilelist(max_index)
             mnufilelist(max_index).Caption = mystring
             mnufilelist(max_index).Visible = True
          End If
       Loop
  Close #file                           '关闭文件菜单列表
End Sub

Private Sub MDIForm_Unload(Cancel As Integer)
  close_Click
End Sub

Private Sub mnufilelist_Click(Index As Integer)
  If mnufilelist(Index).Caption <> "" Then
    Static i As Integer
  If i < 1 Then i = 1
  main_frm.Visible = False
  Dim main As New main_frm
  main.Caption = mnufilelist(Index).Caption
  i = i + 1
  main.Picture = LoadPicture(mnufilelist(Index).Caption)
  main.Show
  End If
End Sub
Private Sub open_Click()  '打开带图形的窗体
  CommonDialog1.Filter = "所有图形文件" & "|*.jpg; *.bmp ; *.ico ;*.gif;*.cur"
  CommonDialog1.ShowOpen
  Static i As Integer
  If i < 1 Then i = 1
  main_frm.Visible = False
  Dim main As New main_frm
  main.Caption = CommonDialog1.FileName
  i = i + 1
  main.Picture = LoadPicture(CommonDialog1.FileName)
  main.Show
  max_index = mnufilelist.Count
  Load mnufilelist(max_index)
  mnufilelist(max_index).Caption = CommonDialog1.FileName
  mnufilelist(max_index).Visible = True
End Sub
Private Sub exit_Click()
  close_Click
  End
End Sub

⌨️ 快捷键说明

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