Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get color of default TextBox.

24 views
Skip to first unread message

dusta...@hotmail.com

unread,
Mar 5, 2006, 1:55:46 AM3/5/06
to
When you create some controls such as a TextBox or a TreeView, they are
created with a bluish border around them (if u are using the default
blue windows XP style). I want to create a Label, and draw a border
around the label with the same border shown around the TextBox. How
can I do this?

So far I am drawing the border in the Paint method for the label using
ControlPaint.DrawBorder. However, I do not know how to get the exact
color that the TextBox uses for its border. I have enumerated through
all the System.Drawing.SystemColors, and it is not there?

Thanks for your help.

Cerebrus

unread,
Mar 5, 2006, 7:48:05 AM3/5/06
to
Hi,

I think you should be able to find that color in the SystemColors
enumeration. Wonder why you're not able to find it...

Colors for a dark border usually are "ControlDark" or
"ControlDarkDark". For the "lighter" side of the border, they usually
are White or "ControlLight". I never use the Windows XP style (I prefer
Classic style), so can't say offhand.

Other ideas that come in my mind are :

1. Check the settings in the Display properties dialog box of Win XP.
You might find the color there.
2. You might try a Color Picker tool, and "pick" the color to determine
it's RGB values. Then use that color.

HTH,

Regards,

Cerebrus.

0 new messages