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

解决方案 »

  1.   

    Dim WithEvents pic As PictureBoxPrivate Sub Form_Click()
      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
      

  2.   

    Private Sub Form_Click()
        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