Option ExplicitDim pic As VB.PictureBoxDim i As IntegerPrivate Sub Command1_Click()
Set txt1(0) = Controls.Add("VB.PictureBox", "pic1")
With pic(0)
.Visible = True
.Left = 0
End With
End Sub
Set txt1(0) = Controls.Add("VB.PictureBox", "pic1")
With pic(0)
.Visible = True
.Left = 0
End With
End Sub
Set pic = Me.Controls.Add("VB.PictureBox", "Pic1", Me)
pic.Top = 200
pic.Left = 200
pic.Width = 4000
pic.Height = 5000
pic.Visible = True
End SubPrivate Sub Pic_DblClick()
MsgBox "双击动态创建的控件"
End Sub
Me.Controls.Add "vb.PictureBox", "Pic", Form1
With Form1!pic
.Top = 100
.Left = 100
.Width = 1500
.Height = 1500
.BackColor = vbRed
.Visible = True
End With
End Sub