【发布时间】:2015-12-21 14:18:58
【问题描述】:
我有这个以bmp格式绘制图像的功能
private void DrawImage(Byte[] imgData, PictureBox picBox)
{
int colorval;
Bitmap bmp = new Bitmap(m_ImageWidth, m_ImageHeight);
picBox.Image = (Image)bmp;
for (int i=0; i<bmp.Width; i++)
{
for (int j=0; j<bmp.Height; j++)
{
colorval = (int)imgData[(j*m_ImageWidth)+ i];
bmp.SetPixel(i,j,Color.FromArgb(colorval,colorval, colorval));
}
}
picBox.Refresh();
}
当我添加picBox.Image.Save(@"C:\Users\Jose Moreno\Desktop", System.Drawing.Imaging.ImageFormat.Bmp);
在 PicBox.Refresh(); 下,程序崩溃并出现错误: “System.Drawing.dll 中发生了“System.Runtime.InteropServices.ExternalException”类型的未处理异常”
程序为什么会崩溃?那是帮助。
【问题讨论】:
-
filename呢?