PDA

View Full Version : Setting A Lines Colour



tea_boy
11-09-2006, 04:40 AM
Hi, I have seen the colour chart posted in the FAQ, does anyone have an equivalent chart that can be used for c#? I am currently trying to set the forecolor of a line object, which takes an integer value.

I have tried the following but it throws a runtime error saying the parameter is incorrect

arrow.Line.ForeColor = Color.Red.ToArgb();

Any help would be appreciated

Thanks tea_boy

Wilfried
11-10-2006, 12:48 PM
Hi,

Just use the int value. Color in windows is the 3 lower byte of integer. Lowest is red, second is green, higher is blue.


arrow.Line.ForeColor = 0x0000FF; // red
arrow.Line.ForeColor = 0x00FF00; // green
arrow.Line.ForeColor = 0xFF0000; // blue

and so you can mix and have any color value, chrominance and intensity you wants. If you experiment a bid you dont need all these constands anymore :)


Olive 0x008080
Navy 0x800000
Purple 0x800080
Teal 0x808000
Gray 0x808080
Silver 0xC0C0C0