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

VB.NET源码-156个实用实例哦…… <script type="text/javascript"> </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~~~~~郁闷~~~~~

谢谢你啊!!!!呵呵!!分给你了!!!!
__________________________________________________________________________
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值