How to get color of default TextBox.

  • Thread starter Thread starter dustamulet
  • Start date Start date
D

dustamulet

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

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

Back
Top