以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  pictruebox的图片怎么获取其路径  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=53475)

--  作者:sky-18
--  发布时间:2014/7/8 19:36:00
--  pictruebox的图片怎么获取其路径

求助,,

我想双击picturebox后用Process打开其对应的image,

但是picturebox的图片路径如何获取呢?

还有picturebox的imagefile属性是什么意思.帮助文件里的详细说明根本就没有提到imagefile这几个字啊.


图片点击可在新窗口打开查看此主题相关图片如下:搜狗截图20140708193438.jpg
图片点击可在新窗口打开查看

--  作者:有点甜
--  发布时间:2014/7/8 19:49:00
--  

  直接获取即可。

 

pbx.ImageFile

 

 如果是web图片路径,用

 

pbx.WebImage


--  作者:sky-18
--  发布时间:2014/7/8 22:06:00
--  报告甜老师

之前我就是用pbx.imagefile,,,但是我用messagebox.show(pbx.imagefile)查看发现什么都没有

 

If e.sender.Name.Contains("tpx") Then
messagebox.show(e.sender.imagefile)
Dim Proc As New Process
Proc.File = e.sender.imagefile
Proc.Start()
End If

 

后来我在想是不是e.sender无法引用所以属性,所以我又改成这样

 

If e.sender.Name.Contains("tpx") Then
Dim pbx As WinForm.PictureBox
pbx = e.sender
messagebox.show(pbx.imagefile)
Dim Proc As New Process
Proc.File = pbx.imagefile
Proc.Start()
End If

 

结果一样

 

求甜老师指点


--  作者:sky-18
--  发布时间:2014/7/8 22:08:00
--  
自己顶一下
--  作者:有点甜
--  发布时间:2014/7/8 22:08:00
--  
 你是怎样给pbx设置图片路径的?
--  作者:有点甜
--  发布时间:2014/7/8 22:12:00
--  
 如果你是通过 Forms("窗口1").Controls("PictureBox1").Image = GetImage("d:\\001.jpg") 这样设置,ImageFile肯定是没有值
--  作者:sky-18
--  发布时间:2014/7/8 22:14:00
--  

对对对,,我就是这样设置图片的.

为什么这样就没有值呢?

如果是这样设置图片的话就无法引用到pictruebox的图片路径吗?


--  作者:有点甜
--  发布时间:2014/7/8 22:15:00
--  

回复7楼,是的。

 

你要这样设置 Forms("窗口1").Controls("PictureBox1").ImageFile = "d:\\001.jpg"


--  作者:sky-18
--  发布时间:2014/7/8 22:16:00
--  
用image或imagefile给picturebox设置图片有什么不同呢,,用哪个好?
--  作者:有点甜
--  发布时间:2014/7/8 22:19:00
--  
 效率一样,ImageFile更方便。