'按空格生成控件 Private Sub Form_KeyPress(KeyAscii As Integer) Static i As Long If KeyAscii = 32 Then Load Command1(i + 1) Command1(i + 1).Visible = True Command1(i + 1).Top = 0 Command1(i + 1).Left = Command1(i).Left + 500 i = i + 1 End If End SubPrivate Sub Form_Load() Me.KeyPreview = True End Sub
'试试下面的代码在form上放个Frame1 设置index 为 0Dim i As LongPrivate Sub Command1_Click() Load Frame1(i + 1) Frame1(i + 1).Visible = True Frame1(i + 1).Caption = "Frame" & (i + 2) Frame1(i + 1).Left = Frame1(i).Left + Frame1(i).Width i = i + 1 End SubPrivate Sub Command2_Click() If i > 0 Then Unload Frame1(i) i = i - 1 End If End Sub
'加载Option控件 Private Sub Command1_Click() t = Option1.Count Load Option1(t+1) Option1(1).Left = Left Option1(1).Top = Top Option1(1).Visible = True End Sub
arr(i+1).Left =
arr(i+1).Top =
arr(i+1).Width =
arr(i+1).Height =
arr(i+1).Caption = arr(i+1).Visible = True
Form1.Refresh
Private Sub Form_KeyPress(KeyAscii As Integer)
Static i As Long
If KeyAscii = 32 Then
Load Command1(i + 1)
Command1(i + 1).Visible = True
Command1(i + 1).Top = 0
Command1(i + 1).Left = Command1(i).Left + 500
i = i + 1
End If
End SubPrivate Sub Form_Load()
Me.KeyPreview = True
End Sub
load arr(i)
arr(i).visible=true
Load Frame1(i + 1)
Frame1(i + 1).Visible = True
Frame1(i + 1).Caption = "Frame" & (i + 2)
Frame1(i + 1).Left = Frame1(i).Left + Frame1(i).Width
i = i + 1
End SubPrivate Sub Command2_Click()
If i > 0 Then
Unload Frame1(i)
i = i - 1
End If
End Sub
Private Sub Command1_Click()
t = Option1.Count
Load Option1(t+1)
Option1(1).Left = Left
Option1(1).Top = Top
Option1(1).Visible = True
End Sub