📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 2970
ClientLeft = 165
ClientTop = 735
ClientWidth = 6030
LinkTopic = "Form1"
ScaleHeight = 2970
ScaleWidth = 6030
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdRead
Caption = "生成动态菜单"
Height = 495
Left = 3120
TabIndex = 7
Top = 2040
Width = 1935
End
Begin VB.CommandButton cmdWrite
Caption = "写入INI文件"
Height = 495
Left = 1320
TabIndex = 6
Top = 2040
Width = 1575
End
Begin VB.TextBox txtValue
Height = 375
Left = 2760
TabIndex = 5
Top = 1440
Width = 2175
End
Begin VB.TextBox txtKey
Height = 375
Left = 2760
TabIndex = 3
Top = 840
Width = 2175
End
Begin VB.TextBox txtSection
Height = 375
Left = 2760
TabIndex = 1
Top = 240
Width = 2175
End
Begin VB.Label Label3
Caption = "输入关键字值:"
Height = 255
Left = 720
TabIndex = 4
Top = 1440
Width = 1935
End
Begin VB.Label Label2
Caption = "输入关键字:"
Height = 255
Left = 720
TabIndex = 2
Top = 840
Width = 1695
End
Begin VB.Label Label1
Caption = "输入段落:"
Height = 255
Left = 720
TabIndex = 0
Top = 240
Width = 1575
End
Begin VB.Menu mnuFile
Caption = "文件"
Begin VB.Menu mnuFileExit
Caption = "退出"
End
Begin VB.Menu mnuFileDM
Caption = "-"
Index = 0
Visible = 0 'False
End
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 Sub cmdRead_Click()
Dim sCaption As String
Dim sFile As String
Dim i As Integer
sFile = "MyTry.ini"
'这段程序只能创建4个动态菜单项
'经过修改,可以扩充其功能
'这里只是提供一个创建动态菜单的思路
For i = 1 To 4
'通过循环取得每个关键字的值,用来作为菜单标题
sCaption = Trim$(GetINI(sFile, "动态菜单", "Menu" & i))
'载入动态菜单
Load mnuFileDM(i)
mnuFileDM(i).Visible = True
mnuFileDM(i).Caption = sCaption
Next i
'目的是为了显示一个分隔符
mnuFileDM(0).Visible = True
End Sub
Private Sub cmdWrite_Click()
Dim sFile As String
sFile = "MyTry.ini"
'如果原来不存在INI文件,则自动创建一个
WriteIni sFile, Trim$(txtSection.Text), Trim$(txtKey.Text), _
Trim$(txtValue.Text)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -