先添加一个Command1(0) Index 属性设为 0Dim i& Private Sub Form_Load() Set Command1(0).Container = Frame1 Command1(0).Move 0, 0 For i = 1 To 3 Load Command1(i) Command1(i).Visible = True Command1(i).Left = Command1(i - 1).Left + Command1(0).Width Next i End Sub
Private Sub Form_Load()
Set Command1(0).Container = Frame1
Command1(0).Move 0, 0
For i = 1 To 3
Load Command1(i)
Command1(i).Visible = True
Command1(i).Left = Command1(i - 1).Left + Command1(0).Width
Next i
End Sub