当前位置:编程学习 > C#/ASP.NET >>

picturebox

Bitmap tempBit = new Bitmap(dlg.FileName);
  pictureBox1.Image = new Bitmap(tempBit, 240, 220);


picturebox已经显示图片了,
那么我怎么能够通过picturebox1控件本身获取到 当前图片的文件名(不包含路径,只要文件名)
有没有什么属性或方法。 --------------------编程问答-------------------- 可以直接设置pictureBox1.ImageLocation = dlg.FileName 
pictureBox 会自动读取图片,要获取文件名的时候,再获取pictureBox1.ImageLocation[align=center]***********************************************************                    欢迎使用 CSDN 小秘书
              http://blog.csdn.net/whowhen21***********************************************************[/align] --------------------编程问答-------------------- 取文件名,可以用 FileInfo 来取
FileInfo file = new FileInfo("文件路径");
string fileName = file.Name;

[align=center]***********************************************************
本内容使用CSDN小秘书回复
每天回帖即可得10分可用分!
***********************************************************[/align]
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,