c#怎么生成一张只有背景颜色的图片
Bitmap outputColor = new System.Drawing.Bitmap(1024, 768,PixelFormat.Format24bppRgb(255,2,0));
//Graphics g = Graphics.FromImage(output);
outputColor.Save(Application.StartupPath + "/res/cus/color.jpg ", ici, ep);
outputColor.Dispose();
picPath = Application.StartupPath + "/res/cus/color.jpg ";
这样只是生声一张黑色的
能不能生成自定义颜色的
------解决方案--------------------这样改一下就行了:
Bitmap outputColor = new System.Drawing.Bitmap(1024, 768,PixelFormat.Format24bppRgb(255,2,0));
Graphics g = Graphics.FromImage(output);//建立这个Bitmap的Graphics.
g.Clare(color);//这里用指定的颜色刷新整个Bitmap.
...
------解决方案--------------------Graphics g = Graphics.FromImage(output);
g.FillRectangle(Brushes.Red , 0,0, 1024, 768);