How to retrieve the border colour of a TextBox?

  • Thread starter Thread starter Dan Soendergaard
  • Start date Start date
D

Dan Soendergaard

Hi,

I'm writing my own control and I would like it to integrate nicely
into the rest of my application, which uses the standard controls
primarely. I therefore wanted my control to use the same border colour
as the rest of the controls, ex the TextBox control. After trying all
the colours in SystemColors, I was still unable to find the correct
colour. Then searched Google, and the only thing that came up was
this:

http://groups.google.com/group/micr...lor+of+textbox+border&rnum=7#832eb0107f51e5df

Does that mean, that it is impossible to get the right colour? I could
of course do as suggested in the post (getting the RGB value and using
that), but it wouldn't work if my user used another Windows style.

Any suggestions?

Thanks in advance!

Dan
 
The system set themes can read using Environment.GetEnvironmentVariable("");
I don't remember what's is the variable that is used to get the default
system color. this color or theme is used as border color for boxes..

HTH
VJ
 
The system set themes can read using Environment.GetEnvironmentVariable("");
I don't remember what's is the variable that is used to get the default
system color. this color or theme is used as border color for boxes..

HTH
VJ

I just tried to use Environment.GetEnvironmentVariables() to get all
the variables, but none of them had anything to do with the Windows
Themes. Maybe it's a completely custom variable or something?
 
The other option would be to see if you anything in the Native API that you
can use..

are in 1.1 or 2.0 ?

VJ
 
The other option would be to see if you anything in the Native API that you
can use..

are in 1.1 or 2.0 ?

VJ

I'm using 2.0. Yes, P/Invoke is a possibility, but I have very little
experience with it. Could you give me some pointers to where to go? (I
have the Windows SDK, but it is huge!)

Dan
 
yes P/Invoke is a option.. I have some experience using it.. but again each
is different than the other. You can try codeproject.com or similar sites
for samples.. also
http://www.pinvoke.net/ is where I start mostly when I need something

VJ
 
yes P/Invoke is a option.. I have some experience using it.. but again each
is different than the other. You can try codeproject.com or similar sites
for samples.. alsohttp://www.pinvoke.net/ is where I start mostly when I need something

VJ

Thanks, I'll look into it when I get some time!
 
Hi,

Just for information I had the same problem and the solution is very easy.

You can find the color property here :

Color TextBoxBorderColor = System.Windows.Forms.VisualStyles.VisualStyleInformation.TextControlBorder;

++



Dan Soendergaard wrote:

Re: How to retrieve the border colour of a TextBox?
16-mars-07

Thanks, I will look into it when I get some time!

Previous Posts In This Thread:

On mercredi 14 mars 2007 8:43
Dan Soendergaard wrote:

How to retrieve the border colour of a TextBox?
Hi,

I'm writing my own control and I would like it to integrate nicely
into the rest of my application, which uses the standard controls
primarely. I therefore wanted my control to use the same border colour
as the rest of the controls, ex the TextBox control. After trying all
the colours in SystemColors, I was still unable to find the correct
colour. Then searched Google, and the only thing that came up was
this:

http://groups.google.com/group/micr...lor+of+textbox+border&rnum=7#832eb0107f51e5df

Does that mean, that it is impossible to get the right colour? I could
of course do as suggested in the post (getting the RGB value and using
that), but it wouldn't work if my user used another Windows style.

Any suggestions?

Thanks in advance!

Dan

On mercredi 14 mars 2007 9:48
VJ wrote:

The system set themes can read using Environment.
The system set themes can read using Environment.GetEnvironmentVariable("");
I don't remember what's is the variable that is used to get the default
system color. this color or theme is used as border color for boxes..

HTH
VJ


On mercredi 14 mars 2007 12:44
Dan Soendergaard wrote:

Re: How to retrieve the border colour of a TextBox?
I just tried to use Environment.GetEnvironmentVariables() to get all
the variables, but none of them had anything to do with the Windows
Themes. Maybe it is a completely custom variable or something?

On mercredi 14 mars 2007 13:08
VJ wrote:

The other option would be to see if you anything in the Native API that you
The other option would be to see if you anything in the Native API that you
can use..

are in 1.1 or 2.0 ?

VJ

On mercredi 14 mars 2007 13:15
Dan Soendergaard wrote:

Re: How to retrieve the border colour of a TextBox?
I am using 2.0. Yes, P/Invoke is a possibility, but I have very little
experience with it. Could you give me some pointers to where to go? (I
have the Windows SDK, but it is huge!)

Dan

On mercredi 14 mars 2007 14:07
VJ wrote:

yes P/Invoke is a option.. I have some experience using it..
yes P/Invoke is a option.. I have some experience using it.. but again each
is different than the other. You can try codeproject.com or similar sites
for samples.. also
http://www.pinvoke.net/ is where I start mostly when I need something

VJ


On vendredi 16 mars 2007 6:06
Dan Soendergaard wrote:

Re: How to retrieve the border colour of a TextBox?
Thanks, I will look into it when I get some time!

EggHeadCafe - Software Developer Portal of Choice
The "Gurus of Gartner" Ride Again [Commentary]
http://www.eggheadcafe.com/tutorial...39e-49ed3e292021/the-gurus-of-gartner-ri.aspx
 
Back
Top