WinForm中使用 PictureBox中显示出现红叉

wshcdr 2010-09-17 04:14:01

PictureBox imageViewer = new PictureBox();
imageViewer.Image = Image.FromFile("c://XXX.JPG");

imageViewer.SizeMode = PictureBoxSizeMode.StretchImage;

imageViewer.Height = 120;
imageViewer.Width = 120;


XXX.JPG比较大14M
有没有办法解决?
...全文
895 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
aaa740713995 2010-09-29
  • 打赏
  • 举报
回复
你这图片还真的大来着
crackdung 2010-09-24
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 liyf_liyunfeng 的回复:]

哪有这么大的图片,有问题撒,先把图片转成bmp格式的。
[/Quote]

jpg比bmp还小啊
liyf_liyunfeng 2010-09-24
  • 打赏
  • 举报
回复
哪有这么大的图片,有问题撒,先把图片转成bmp格式的。
dingpo2099 2010-09-22
  • 打赏
  • 举报
回复
UP~~~
kongdelu2008 2010-09-21
  • 打赏
  • 举报
回复
估计是图片太大的原因,picturebox内存空间出错导致的,这种问题还没遇到过!
changjiangzhibin 2010-09-20
  • 打赏
  • 举报
回复

//比较灵活的用法,便于封装
FileStream fs = new FileStream(“c://XXX.JPG", FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
byte[] bytes = br.ReadBytes((int)fs.Length);
br.Close();
fs.Close();
MemoryStream ms = new MemoryStream(bytes);
Image img = Image.FromStream(ms);
ms.Close();
ms.Dispose();
wuyq11 2010-09-20
  • 打赏
  • 举报
回复
几M的图片没有问题,但是如果上百M的,那估计不行了
Image类的GetThumbnailImage方法
hongjiaoli 2010-09-20
  • 打赏
  • 举报
回复
先换个小点的图片试试,如果可以显示,就是你图片的问题了。否则的话,是代码错了。
wshcdr 2010-09-20
  • 打赏
  • 举报
回复
恩,图片很大
ZXY900213 2010-09-20
  • 打赏
  • 举报
回复
不是吧,一张图片就有14M?
hao1hao2hao3 2010-09-18
  • 打赏
  • 举报
回复

PictureBox myPictureBox = new PictureBox();
myPictureBox.Location = new Point(0, 0);
myPictureBox.Size = new Size(1000, 1000);
myPictureBox.Image = new Bitmap("c://XXX.JPG");
this.Controls.Add(myPictureBox);


17,740

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 .NET Framework
社区管理员
  • .NET Framework社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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