[VB.NET]如何通过FileListBox在PictureBox显示图片!!!!

来源:互联网 发布:淘宝店铺转让 编辑:程序博客网 时间:2024/04/28 02:20
VB.NET源码-156个实用实例哦……<script type="text/javascript"><!--google_ad_client = "pub-8333940862668978";/* 728x90, 创建于 08-11-30 */google_ad_slot = "4485230109";google_ad_width = 728;google_ad_height = 90;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
如何通过FileListBox在PictureBox显示图片!!!!
请问,我已经在FileListBox现在了图片文件列表,应该怎么做在单击其中一个图片文件的时候,在PictureBox立即显示出来呢??

还有应该怎么做才能 通过 “上一个” “下一个”的按钮来显示filelistbox中的图片呢!!!

麻烦大家了!!!!
__________________________________________________________________________
FileListBox是什么控件?
__________________________________________________________________________
在单击的事件中写入

Me.PictureBox1.Image = Image.FromFile( "含路径文件名 ")

就行了。
__________________________________________________________________________
这个“含路径文件名”是通过点击filelistbox下的图片文件获得的!!要怎么获得呢???
__________________________________________________________________________
我没用过FileListBox这个控件,工具箱里没有噢。
__________________________________________________________________________
不过您既然能把文件加载到这个控件中那么应该可以用某种形式来保存他们的文件名吧,实在不行就定义一个字符串数组,把文件名保存在里面;用FileListBox的Index值来匹配数组的Index,也可以的。
__________________________________________________________________________
FileListBox是通过在工具箱中添加/删除项 来加入的!是用来显示目录下的文件~~
我用
Me.PictureBox1.Image = Image.FromFile( "FileListBox1.Items.Strings[FileListBox1.Itemindex] ")

还是不行 郁闷死了~~大家帮帮忙啊!!
__________________________________________________________________________
现在的问题是如何获得FileListBox这个控件下的路径和文件名,然后通过单击在PictureBox下显示!!!
__________________________________________________________________________
明明只有我一个在这儿么…… -_-|||
__________________________________________________________________________
晕掉了~~~没有知道么~~55555
__________________________________________________________________________
Public Class Form1

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.FileListBox1.Path = "D:/My Documents/My Pictures "
End Sub

Private Sub FileListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles FileListBox1.SelectedIndexChanged
Me.PictureBox1.Image = Image.FromFile(Me.FileListBox1.Path & "/ " & Me.FileListBox1.Items(Me.FileListBox1.SelectedIndex).ToString)
End Sub
End Class
__________________________________________________________________________
Private Sub FileListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles FileListBox1.SelectedIndexChanged
Me.PictureBox1.Image = Image.FromFile(Me.FileListBox1.Path & "/ " & Me.FileListBox1.Items(Me.FileListBox1.SelectedIndex).ToString)
End Sub

用这个可以啦,呵呵。
__________________________________________________________________________
-_-|||,这样写好一点。

Private Sub FileListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles FileListBox1.SelectedIndexChanged
Me.PictureBox1.Image = Image.FromFile(Me.FileListBox1.Path & "/ " & Me.FileListBox1.SelectedItem.ToString)
End Sub
__________________________________________________________________________
我刚才这么做
Me.PictureBox1.Image = Image.FromFile(FileListBox1.Path & " / " & FileListBox1.FileName)

原来第二个忘记用select~~~~~郁闷~~~~~

谢谢你啊!!!!呵呵!!分给你了!!!!
__________________________________________________________________________
原创粉丝点击