怎样用vb.net做一个图片浏览器?

来源:百度知道 编辑:UC知道 时间:2024/07/02 05:36:42
把所需的控件和控件代码说清楚就OK了

在自定义工具箱中选择dirlistbox,drivelistbox,filelistbox,添加这3个控件,然后在窗体上添加这些控件和一个picturebox控件,代码如下:
Public Class Form1

Private Sub DirListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DirListBox1.SelectedIndexChanged
FileListBox1.Path = DirListBox1.Path
End Sub

Private Sub DriveListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DriveListBox1.SelectedIndexChanged
DirListBox1.Path = DriveListBox1.Drive
End Sub

Private Sub FileListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles FileListBox1.SelectedIndexChanged
PictureBox1.Image = Image.FromFile(FileListBox1.Path + "\" + FileListBox1.SelectedItem.ToString())
End Sub
End Class
你可以自己在修改下,这只是个模型,呵呵!