none
如何显示下一张图片 RRS feed

  • 问题

  • 我学做的项目中有一个form1,上面放了一个容器tablelayoutpanel1,这个容器上又放了一个picturebox1和一个button1(命名为 “下一张”)。我已经把几张图片以添加资源的方式添加到了resources中。我想做的是点一下button1(“下一张”)按钮,picturebox1就显示下一张图片。该怎么做呢,请高手赐教
    2015年5月18日 8:35

答案

  • 你好,

    你可以用一个ImageList来收集你的图片,然后通过改变index来显示下一张图片。

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            PictureBox1.Image = ImageList1.Images(index)
    
        End Sub
    
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            If index < ImageList1.Images.Count - 1 Then
                index += 1
                PictureBox1.Image = ImageList1.Images(index)
            Else
                index = 0
                PictureBox1.Image = ImageList1.Images(index)
            End If
    
        End Sub


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    2015年5月19日 6:23
    版主