用ListImage做图片的上一张和下一张的切换 !求高手帮助~谢谢了,紧急呀
用ListImage做图片的上一张(+)和下一张(-)的切换。有四张图片,有控件Button1作为上一张(+)和Button2作为下一张(-) 。并且在Label2中告知用户,这是第几张图片(必须与图片顺序号码相符),当点击上一张为最后一张图片时,能切换到第一张图片并能继续重复阅览,点击下一张时也能灵活切换~Public Class Form1
Dim i As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.ImageIndex = i
i = i + 1
Label2.Text = "当前显示的是第" & i & "张图片"
Label2.Left = (Me.Width - Label2.Width) / 2
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
i = i + 1
If i = 5 Then
i = 1
End If
Label1.ImageIndex = Label1.ImageIndex + 1
Label2.Text = "当前显示的是第" & i.ToString & "张图片"
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
i = i - 1
If i = 1 Then
i = 5
End If
Label1.ImageIndex = Label1.ImageIndex - 1
Label2.Text = "当前显示的是第" & i & "张图片"
End Sub
End Class
这个是我的代码,求助高手帮忙~~谢谢了