图片框不显示图像

时间:2018-02-06 09:30:21

标签: .net vb.net winforms

我需要帮助在运行时显示图片框

Private Sub LoadCards()
    Dim Cards As New PictureBox

    For i As Integer = 0 To imglist1.Images.Count - 1
        Cards.Image = imglist1.Images(i)
    Next i


End Sub

1 个答案:

答案 0 :(得分:0)

请先将您的照片框添加到表单中,如下所示:

Dim Cards  As New PictureBox
Cards.Width = 100 'or whatever
Cards.Height = 200
Cards.Top = 50 'or whatever
Cards.Left = 50
Me.Controls.Add(Cards)

然后进行操作,虽然这里的For循环没有多大意义:

For i As Integer = 0 To imglist1.Images.Count - 1
    Cards.Image = imglist1.Images(i)
Next i