在picturebox中binding图片

zj558 2006-04-05 10:34:58
因为这个需要动态捆绑,由于数据库中存着图片的路径
我想把数据库中的图片捆绑在picturebox中,如下代码:
cmAmend = (CurrencyManager) BindingContext[ds.Tables[0]];
FileStream fs=new FileStream(str,System.IO.FileMode.Open,System.IO.FileAccess.Read);
byte[] bytes=new byte[fs.Length];
fs.Read(bytes,0,bytes.Length);
fs.Close();
MemoryStream ms=new MemoryStream(bytes);
this.pictureBox1.Image=Image.FromStream(ms);
如果这样动态捆绑的话,FileStream中的str怎么写啊
...全文
81 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
x_ch 2006-04-08
  • 打赏
  • 举报
回复
cxy2006 2006-04-08
  • 打赏
  • 举报
回复
你数据库里面存着路径 不用那样绑定 直接this.pictureBox1.Image=Image.FromFile("路径")
就OK了 如果你数据库里存的是流 就那样写了.
zj558 2006-04-05
  • 打赏
  • 举报
回复
help

110,566

社区成员

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

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

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