By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,712 Members | 1,413 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,712 IT Pros & Developers. It's quick & easy.

How to retrieve the border colour of a TextBox?

P: n/a
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/micro...2eb0107f51e5df

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

Mar 14 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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

"Dan Soendergaard" <da*****@gmail.comwrote in message
news:11**********************@n59g2000hsh.googlegr oups.com...
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/micro...2eb0107f51e5df

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

Mar 14 '07 #2

P: n/a
On Mar 14, 3:48 pm, "VJ" <nonewsaddr...@yahoo.comwrote:
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

"Dan Soendergaard" <dan1...@gmail.comwrote in message

news:11**********************@n59g2000hsh.googlegr oups.com...
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/micro...languages.csha...
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
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?

Mar 14 '07 #3

P: n/a
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

"Dan Soendergaard" <da*****@gmail.comwrote in message
news:11**********************@o5g2000hsb.googlegro ups.com...
On Mar 14, 3:48 pm, "VJ" <nonewsaddr...@yahoo.comwrote:
>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

"Dan Soendergaard" <dan1...@gmail.comwrote in message

news:11**********************@n59g2000hsh.googleg roups.com...
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/micro...languages.csha...
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

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?

Mar 14 '07 #4

P: n/a
On Mar 14, 7:08 pm, "VJ" <nonewsaddr...@yahoo.comwrote:
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

"Dan Soendergaard" <dan1...@gmail.comwrote in message

news:11**********************@o5g2000hsb.googlegro ups.com...
On Mar 14, 3:48 pm, "VJ" <nonewsaddr...@yahoo.comwrote:
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
"Dan Soendergaard" <dan1...@gmail.comwrote in message
>news:11**********************@n59g2000hsh.googleg roups.com...
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/micro...languages.csha...
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
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?
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

Mar 14 '07 #5

P: n/a
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.. also
http://www.pinvoke.net/ is where I start mostly when I need something

VJ

"Dan Soendergaard" <da*****@gmail.comwrote in message
news:11**********************@l77g2000hsb.googlegr oups.com...
On Mar 14, 7:08 pm, "VJ" <nonewsaddr...@yahoo.comwrote:
>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

"Dan Soendergaard" <dan1...@gmail.comwrote in message

news:11**********************@o5g2000hsb.googlegr oups.com...
On Mar 14, 3:48 pm, "VJ" <nonewsaddr...@yahoo.comwrote:
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
>"Dan Soendergaard" <dan1...@gmail.comwrote in message
>>news:11**********************@n59g2000hsh.google groups.com...
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/micro...languages.csha...
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
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?

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

Mar 14 '07 #6

P: n/a
On Mar 14, 8:07 pm, "VJ" <nonewsaddr...@yahoo.comwrote:
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

"Dan Soendergaard" <dan1...@gmail.comwrote in message

news:11**********************@l77g2000hsb.googlegr oups.com...
On Mar 14, 7:08 pm, "VJ" <nonewsaddr...@yahoo.comwrote:
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
"Dan Soendergaard" <dan1...@gmail.comwrote in message
>news:11**********************@o5g2000hsb.googlegr oups.com...
On Mar 14, 3:48 pm, "VJ" <nonewsaddr...@yahoo.comwrote:
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
"Dan Soendergaard" <dan1...@gmail.comwrote in message
>news:11**********************@n59g2000hsh.googleg roups.com...
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/micro...languages.csha...
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
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?
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
Thanks, I'll look into it when I get some time!

Mar 16 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.