GDI+ 中发生一般性错误。是 图片路径问题吗 本地一切正确 没错误
1个回答
2011-01-28
展开全部
你这样试试
//载入原始图片
Bitmap bmp = new Bitmap(Path);
Graphics graphics;
try
{
graphics = System.Drawing.Graphics.FromImage(bmp);
}
catch (Exception)
{
//对于indexed pixel format,抛出异常的特殊处理
Bitmap newBmp = new Bitmap(bmp.Width, bmp.Height);
graphics = System.Drawing.Graphics.FromImage(newBmp);
graphics.DrawImage(bmp,
new Rectangle(0, 0, newBmp.Width, newBmp.Height),
new Rectangle(0, 0, bmp.Width, bmp.Height),
GraphicsUnit.Pixel);
bmp = newBmp;
}
//载入原始图片
Bitmap bmp = new Bitmap(Path);
Graphics graphics;
try
{
graphics = System.Drawing.Graphics.FromImage(bmp);
}
catch (Exception)
{
//对于indexed pixel format,抛出异常的特殊处理
Bitmap newBmp = new Bitmap(bmp.Width, bmp.Height);
graphics = System.Drawing.Graphics.FromImage(newBmp);
graphics.DrawImage(bmp,
new Rectangle(0, 0, newBmp.Width, newBmp.Height),
new Rectangle(0, 0, bmp.Width, bmp.Height),
GraphicsUnit.Pixel);
bmp = newBmp;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询