Jay Michael
2003-07-24 18:11:53 UTC
I am designing applications using MS VS.NET, and I am
trying to locate information on the default colors the
system uses to color the various components.
I have learned that there are certain "SystemColors" such
as Control and ControlText that the system defines using
the current color scheme that the user has chosen.
However, I can find nothing in the KnownColors enumeration
that defines what colors are used to "gray out" the text of
disabled buttons. I have several buttons on my application
that use customized Paint methods to draw their own
graphics, which are side by side with ones that simply use
the Button control's built-in Text property. The
customized Paint method does not automatically gray out the
graphics when the Button is disabled. I have tried to
determine an algorithm that the system uses to determine
the gray value (such as averaging the ForeColor and
BackColor), but it is not that simple. There are seemingly
five choices of control color (ranging from ControlDarkDark
to ControlLightLight), which all create a different sort of
grayed out text, with the middle value (Control) strangely
producing the lightest version of grayed out text. Using a
custom color for the control also seems to taint the grayed
out text in some fashion that I have yet to determine.
I am holding off on simply not using the Text property and
using a custom text graying algorithm for when the buttons
are disabled, but this seems heavy handed. I would much
prefer to discover what the system is doing automatically
and mimick it.
There is also another minor additional related problem,
which is figuring out what color the system uses to add an
offset highlight to make the grayed out text seem indented
slightly.
Any help would be appreciated, thanks!
Jay Michael
***@flash.net
trying to locate information on the default colors the
system uses to color the various components.
I have learned that there are certain "SystemColors" such
as Control and ControlText that the system defines using
the current color scheme that the user has chosen.
However, I can find nothing in the KnownColors enumeration
that defines what colors are used to "gray out" the text of
disabled buttons. I have several buttons on my application
that use customized Paint methods to draw their own
graphics, which are side by side with ones that simply use
the Button control's built-in Text property. The
customized Paint method does not automatically gray out the
graphics when the Button is disabled. I have tried to
determine an algorithm that the system uses to determine
the gray value (such as averaging the ForeColor and
BackColor), but it is not that simple. There are seemingly
five choices of control color (ranging from ControlDarkDark
to ControlLightLight), which all create a different sort of
grayed out text, with the middle value (Control) strangely
producing the lightest version of grayed out text. Using a
custom color for the control also seems to taint the grayed
out text in some fashion that I have yet to determine.
I am holding off on simply not using the Text property and
using a custom text graying algorithm for when the buttons
are disabled, but this seems heavy handed. I would much
prefer to discover what the system is doing automatically
and mimick it.
There is also another minor additional related problem,
which is figuring out what color the system uses to add an
offset highlight to make the grayed out text seem indented
slightly.
Any help would be appreciated, thanks!
Jay Michael
***@flash.net