一个关于pictureBox的问题

feigehao 2003-08-22 02:29:50
我想在pictureBox中加载动态的图片,各位大侠帮帮忙了,最好写出一定的代码,谢谢
...全文
22 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
jinkaoyan 2003-08-22
  • 打赏
  • 举报
回复
1,
pictureBox1.Image=new Bitmap(imagefromfile);

2,
Graphics pic=pictureBox.CreateGraphics();
pic.DrawImage(imagefromfile)
pic.Dispose();
xiaodele 2003-08-22
  • 打赏
  • 举报
回复
System.IO.FileStream fs=new FileStream(openfiledialog.FileName,FileMode.Open);
this.Image=new Byte[fs.Length];
fs.Read(this.Image,0,(int)fs.Length);
fs.Flush();
fs.Close();
这段不要
xiaodele 2003-08-22
  • 打赏
  • 举报
回复
从数据库中获取图片
System.IO.MemoryStream ms=new MemoryStream((byte[])this.dsRSDA.Tables[0]Rows[0][0]);
this.pictureBox1.Image=new Bitmap(ms);
ms.Close();
从本地获取图片
System.IO.FileStream fs=new FileStream(openfiledialog.FileName,FileMode.Open);
this.Image=new Byte[fs.Length];
fs.Read(this.Image,0,(int)fs.Length);
fs.Flush();
fs.Close();
this.pictureBox1.Image=System.Drawing.Image.FromFile(openfiledialog.FileName);

110,536

社区成员

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

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

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