How do I draw a filled circle onto a graphics object in a hexadecimal colour?

Posted by George Powell on Stack Overflow See other posts from Stack Overflow or by George Powell
Published on 2010-04-04T13:39:47Z Indexed on 2010/04/04 18:23 UTC
Read the original article Hit count: 253

Filed under:
|
|
|

I need to draw a circle onto a bitmap in a specific colour given in Hex. The "Brushes" class only gives specific colours with names.

Bitmap bitmap = new Bitmap(20, 20);
Graphics g = Graphics.FromImage(bitmap);
g.FillEllipse(Brushes.AliceBlue, 0, 0, 19, 19); //The input parameter is not a Hex
//g.FillEllipse(new Brush("#ff00ffff"), 0, 0, 19, 19); <<This is the kind of think I need.

Is there a way of doing this?

The exact problem: I am generating KML (for Google earth) and I am generating lots of lines with different Hex colours. The colours are generated mathematically and I need to keep it that way so I can make as many colours as I want. I need to generate a PNG icon for each of the lines that is the same colour exactly.

© Stack Overflow or respective owner

Related posts about c#

Related posts about color