I would use the GetBrightness method on the color to determine if it's
closer to black or write, and use the other.
The complementary color could be calculated using:
Color.FromArgb(theColor.ToArgb() xor 0x00ffffff)
That doesn't work for all colors, though. The complementary color for
50% gray is 50% gray...
R. MacDonald wrote:
Hello, Group,
If drawing on a control, it would be desirable to select a colour that
significantly differs from the control's background colour. Is there a
standard (or preferred) way to programmatically select a complementary
color at run time?
Thanks in advance for any suggestions.
Cheers,
Randy