Winfrom如何选择指定图片

thunderwolf 2009-05-11 11:58:44
我把需要文件保存到Winfrom 的Properties.Resources的文件夹下。如114.JPG,113.JPG保存到Resources文件夹下

然后当我需要调用113.JPG的时候就显示。需要调用114.JPG就显示114.
我做了一个事件委托:
this.SetpictureBox1(global::CarRegister.Properties.Resources.?);//指示显示

// SetpictureBox1申明的函数
private delegate void ChageImageSafe(System.Drawing.Image text);
private void SetpictureBox1(System.Drawing.Image text_content)//设定pictureBox1的image值
{
if (this.pictureBox1.InvokeRequired) { ChageImageSafe slt = new ChageImageSafe(SetpictureBox1); this.pictureBox1.BeginInvoke(slt, new object[] { text_content }); }
else { this.pictureBox1.Image = text_content; this.pictureBox1.Refresh(); }
}

...全文
118 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhulong1111 2009-05-11
  • 打赏
  • 举报
回复
你要什么图片 设置下图片的路径属性就OK了撒
zgke 2009-05-11
  • 打赏
  • 举报
回复
没明白什么意思....
junweishiwo 2009-05-11
  • 打赏
  • 举报
回复
应该不用这么写吧。

你什么时候想调用这个图片,直接就设置Image属性就行了啊。

Image image = System.Drawing.Bitmap.FromFile(sJPGFilePath);
this.pictureEdit1.Image = image;

sJPGFilePath是图片的路径。这样应该就可以了,没有必要放在委托里。

个人意见!
cpio 2009-05-11
  • 打赏
  • 举报
回复
没搞明白你想要实现什么功能

110,561

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧