Does anyone know of a color-picker
for Visual Studio (Visual Basic) that shows the names of the standard colors?
For example, in Visual Studio, you can alter the color of a control using a color-picker
that has tabs of "Custom"
, "Web"
and "System"
. The Web
& System
options show a list of the color names, whereas Custom
supplies (mainly) RGB (which is what the VB ColorPicker control does).
Thanks!
I don't know about an existing control but you can use the
KnownColor
enumeration and theSystemColors
class to get all the names of thoseColor
values. You can then build your own control, e.g. customComboBox
, with that data.there is precious little to one of these until you want to do like VS and present System Colors apart from Named Colors, make it a popup or some such. Example using colors as the BackGround:
On the form CBO, set the DrawMode to
OwnerDrawFixed
, then:You can just draw a swatch like Windows/VS does by defining a rectangle to fill. Generally, thats swell, but in the case where you are doing something like defining a background color it rather helps to show how it looks with text on it and more of the color than the little bitty swatch - hence the filled CBO Item rect.
The standard window Text color will not show up on all of them. For a "light" theme, Violet and Black etc will hide/make the color name impossible to read.
GetContrastingColor
is a function which evaluates the Brightness of the current color and then returns either White or Black:You can then use all this in a Class which inherits from ComboBox, or build a UserControlif you like distinct controls. You can also leave it as code in a DLL which is called on those occasions. I should mention there are also perhaps a dozen such critters on CodeProject.