请问如何在VB.NET窗体中动态生成PictureBox
我在窗体中添入了一个PictureBox,名为PictureBox1,自动生成以下代码:
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
Me.PictureBox1 = New System.Windows.Forms.PictureBox()
Me.PictureBox1.BackgroundImage = CType(resources.GetObject("PictureBox1.BackgroundImage"), System.Drawing.Bitmap)
Me.PictureBox1.Location = New System.Drawing.Point(360, 80)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(400, 400)
Me.PictureBox1.TabIndex = 0
Me.PictureBox1.TabStop = False
但现在我想按一个钮动态生成1个这样的PictureBox,名为PictureBox2,结果在Click事件中加入以上的代码段但编译出错,由于非典不能出去买书,请高手指教。