SystemColor 'Control' to 'buttonface'

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.
 
A

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.
 
B

bruce barker

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

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,573
Members
45,046
Latest member
Gavizuho

Latest Threads

Top