📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 1680
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 1680
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "Form3"
Height = 975
Index = 2
Left = 3360
TabIndex = 2
Top = 360
Width = 975
End
Begin VB.CommandButton Command1
Caption = "Form2"
Height = 975
Index = 1
Left = 1920
TabIndex = 1
Top = 360
Width = 975
End
Begin VB.CommandButton Command1
Caption = "Form1"
Height = 975
Index = 0
Left = 480
TabIndex = 0
Top = 360
Width = 975
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click(Index As Integer)
Dim myForm As Form '定义变量
For Each myForm In Forms '使用Forms集合
If myForm.Caption = "Form" & CStr(Index + 1) Then
'通过查看窗口标题检查该窗口实例是否已打开
myForm.WindowState = 0 '照原来的尺寸大小和位置打开
myForm.SetFocus '如果已打开,则使其获得焦点
Set myForm = Nothing '释放资源
Exit Sub '跳出过程
End If
Next
Set myForm = New Form1 '创建Form2的窗体实例
Load myForm
myForm.Caption = "Form" & CStr(Index + 1)
'设置其Caption属性,也可作其他操作
myForm.Show
Set myForm = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -