我尝试使用下一个和上一个按钮创建一个图片框,以更改此框中的图片。而且我成功完成了,但是现在我想当我单击每张图片时,它可以执行“复制文件”操作。
请帮助我。
这是我的代码,用于创建下一个和上一个按钮来更改图片框中的图片。
Dim Files() As String
Dim Pointer As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If FolderBrowserDialog1.ShowDialog <> Windows.Forms.DialogResult.Cancel Then
Files = IO.Directory.GetFiles(FolderBrowserDialog1.SelectedPath)
End If
Pointer = -1
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Do
Pointer = (Pointer + 1) Mod Files.Count
Loop Until checkimagetype(Files(Pointer))
Try
PictureBox1.Image = Image.FromFile(Files(Pointer))
Catch ex As Exception
MessageBox.Show(ex.Message & " " & Files(Pointer), My.Application.Info.Title, _
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Do
Pointer -= 1
If Pointer < 0 Then Pointer = Files.Count - 1
Loop Until CheckImageType(Files(Pointer))
Try
PictureBox1.Image = Image.FromFile(Files(Pointer))
Catch ex As Exception
MessageBox.Show(ex.Message & " " & Files(Pointer), My.Application.Info.Title, _
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub