初始化PictureBox数组如何操作
初始化PictureBox数组怎么操作
Dim pics() As PictureBox
' ' ' ' ' ' ' ' ' ' ' ' ' '显示牌
For i = 0 To strs1_len
Dim ss As String = strs1nums(i)
Dim pic As New PictureBox
pic.ImageLocation = "buke/ " & ss & ".png "
pic.Name = ss
pic.Location = New System.Drawing.Point(x - i * 30, y)
pic.Width = 94
pic.Height = 125
AddHandler pic.Click, AddressOf pic_Click
AddHandler pic.MouseDown, AddressOf pic_leftMouse
AddHandler pic.DoubleClick, AddressOf pic_DoubleClick
pics(i) = pic ' ' ' ' ' '这个地方地址错了的,按照提示用new 也还是错了的,请问这个那我要怎么传递给这个数组呢?
panel.Controls.Add(pic)
Next
------解决方案--------------------
pic没有初始化?
------解决方案--------------------
最后那个panel.controls.addrange(pics)比较好.
Dim pics() As PictureBox
' ' ' ' ' ' ' ' ' ' ' ' ' '显示牌
For i = 0 To strs1_len
Dim ss As String = strs1nums(i)
Dim pic As New PictureBox
pic.ImageLocation = "buke/ " & ss & ".png "
pic.Name = ss
pic.Location = New System.Drawing.Point(x - i * 30, y)
pic.Width = 94
pic.Height = 125
AddHandler pic.Click, AddressOf pic_Click
AddHandler pic.MouseDown, AddressOf pic_leftMouse
AddHandler pic.DoubleClick, AddressOf pic_DoubleClick
pics(i) = pic ' ' ' ' ' '这个地方地址错了的,按照提示用new 也还是错了的,请问这个那我要怎么传递给这个数组呢?
panel.Controls.Add(pic)
Next
------解决方案--------------------
pic没有初始化?
------解决方案--------------------
最后那个panel.controls.addrange(pics)比较好.