如何设置图像路径? [英] How to set image path?
本文介绍了如何设置图像路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我正在使用一些包含我的Visual Studio的图像-> widowsapplication1->资源-> flower.jpg
如何设置程序的图像路径.
panel1.setBackground("????图片路径????"));
Hi guys,
I am using some images it contains my Visual studio --> widowsapplication1--> Resources --> flower.jpg
How can i set the path of image to my program.
panel1.setBackground("???? Path of Image ????");
推荐答案
尝试以下代码:
Try this code:
panel1.BackgroundImage = Image.FromFile
(System.Environment.GetFolderPath
(System.Environment.SpecialFolder.Personal)
+ @"\Resource\Image.gif");
// You should replace the bolded image
// in the sample below with an image of your own choosing.
// Note the escape character used (@) when specifying the path.
panel1.BackgroundImage = Image.FromFile
(System.Environment.GetFolderPath
(System.Environment.SpecialFolder.Personal)
+ @"\Image.gif");
http://msdn.microsoft.com/en-us/library/tkhesczs.aspx [
http://msdn.microsoft.com/en-us/library/tkhesczs.aspx[^]
panel1.setBackground("~/images/logo.jpg");
您的文件夹名称中插入了图像.
U r folder name insted of images.
这篇关于如何设置图像路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文