SystemColor 'Control' to 'buttonface'

  • Thread starter Thread starter Ade
  • Start date Start date
A

Ade

Hello, i've noticed that some old system colors have been left out of the
current version of the .net framework, including ButtonFace,
ButtonHighlight & ButtonShadow. It seems these have been replaced by
Control, ControlLight & ControlDark.

The one i'm particularly interested in is Control which when rendered to the
browser is actually output as buttonface. I need to be able to set the color
(in the style attribute of the html) of a custom control on the server side
at runtime and want to be able to convert the system color 'Control' to
'buttonface'. I figure there must be some easy way of doing this but i'm
damned if i can find it.

Anybody, any ideas?

regards,
Ade.
 
Aha! Classic case of posting too soon.

Anyway, if anybody else is looking for the answer to this, you can use the
ColorTranslator class which has a ToHtml method, e.g.

System.Drawing.Color = System.Drawing.SystemColors.Control;

string htmlColor = ColorTranslator.ToHtml(color);

which will return 'buttonface'

:)

Ade.
 
of cource this will be the servers buttonface color, not the browsers.

-- bruce (sqlwork.com)
 
Back
Top