我从来没有使用System.Drawing之前,所以忍受我,因为这是我找到并放在一起的代码mich马赫。C#自定义颜色黑色
我试图与顶部的白色和底部创建一个图像另一种颜色(最终将图片添加到它)
我的代码:
Bitmap bmp = new Bitmap(800, 800, PixelFormat.Format32bppArgb);
using (Graphics gfx = Graphics.FromImage((Image)bmp))
{
gfx.FillRectangle(Brushes.Transparent, new RectangleF(0, 0, bmp.Width, bmp.Height));
gfx.FillRectangle(Brushes.White, 0, 0, 800, 600);
gfx.FillRectangle(new SolidBrush(Color.FromArgb(21, 93, 127)), 600, 800, 0, 800);
}
bmp.Save("C:\test.jpg", ImageFormat.Bmp);
但是我的成绩是最高的白色,底部黑色......不知道我做错了什么。
我也试过gfx.FillRectangle(new SolidBrush(System.Drawing.ColorTranslator.FromHtml("#155d7f")), 600, 800, 0, 800);
数字它只是我的坐标。谢谢你的工作。 – 2013-04-26 18:09:10