请问c#中BackgroundImage 的路径问题 用form.BackgroundImage = Image.FromFile(@"D:\image.jpg");语句后,我想再别的地方取得背景图片的本地路径该怎么办? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你用一个string来保存你的路径不就可以了,像这样:public static string filepath = @"D:\image.jpg";form.BackgroundImage = Image.FromFile(filepath);你在直接取filepath不就可以了。 可以把地址字符串放在资源文件里 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.PictureBox1.BackgroundImage = resources.GetString("imgfilepath"))); public static string filepath = @"D:\image.jpg"; form.BackgroundImage = Image.FromFile(filepath); C#生成的dll可以被其他程序vc6,vb6,delphi,flash等调用吗。请那位大狭给点提示。 WF小问题 紧急求助ON_MESSAGE()宏出错,望好手指点 窗体里面的splitContainer控件消失. PrintDocument 問題 怎样避免单击button不触发WebForm的page_load?? 如何编写一个窗框自动打开指定网址的代码 关于.net remoting 传输数据速度的问题? 请教:怎么解决Jmail收邮件时,中文名称的附件名称是乱码的问题 初学者问题:请问哪位有C#关于类型转换的资料! 高手帮忙 C#动态创建Picture控件的问题
像这样:
public static string filepath = @"D:\image.jpg";
form.BackgroundImage = Image.FromFile(filepath);
你在直接取filepath不就可以了。
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.PictureBox1.BackgroundImage = resources.GetString("imgfilepath")));
form.BackgroundImage = Image.FromFile(filepath);