用Graphics画图时画不出来
代码: private Image DrawPic(IDictionary<string, Image> picList, IDictionary<string, LayerType> layerTypeList) {
Image backimg = null;//身体图片
Image bit = null; //中专图
//循环合成
foreach (KeyValuePair<string, LayerType> item in layerTypeList) {
LayerType layerType = item.Value;
if (layerType == null)
continue;
Image pic = picList[item.Key]; //得到相应坐标的图片或者文字
if (pic == null)
continue;
if (item.Key == "body") {
backimg = pic;
continue;
}
#region 背景与其他图片合成
bit = pic;
Graphics gh = Graphics.FromImage(backimg);
gh.DrawImage(bit, layerType.X, layerType.Y, layerType.Width, layerType.Height);
gh.Dispose();
#endregion
}
return backimg;
}
执行到红色字体的时候, 就直接蹦出窗体了, 也不报错。 是什么原因
------解决方案--------------------
try
catch
------解决方案--------------------
http://www.cnblogs.com/john-cncn/articles/1013609.html