Private Sub Command1_Click()
Dim a As Label
Dim i As Integer
For i = 0 To 9
Set a = Form1.Controls.Add("VB.Label", "Label" & i)
a.Visible = True
a.Move i * 500, i * 400, 1000, 300
a.BackColor = RGB(100, 150, 200)
a.Caption = "Label" & i
Next
End Sub
Private Sub Form_Load()
Form1.Controls.Add "VB.CommandButton", "cmdOk", Picture1
With Form1!cmdOk
.Visible = True
.Width = 500
.Caption = "确认(&Y)"
End With
End Sub