473,387 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Determine color scheme used by app

I want to determine the Windows color scheme that is being used by my app.
This means that I need to determine the following:

1. Does the OS support themes?
2. Are themes currently enabled within the OS?
3. Are themes currently enabled within the application?
4. If all of the above are true, then what color scheme is being used (e.g.,
Default (blue), Olive Green or Silver if the OS is Windows XP)?

Also, I have not used Windows Vista so any help with the possible color
schemes with that OS would be greatly appreciated.

Thanks for any help!
Lance

Oct 2 '07 #1
8 2462
"ljlevend2" <lj*******@nospam.nospamschrieb
I want to determine the Windows color scheme that is being used by
my app. This means that I need to determine the following:

1. Does the OS support themes?

System.Windows.Forms.VisualStyles.VisualStyleInfor mation.IsSupportedByOS
2. Are themes currently enabled within the OS?
System.Windows.Forms.VisualStyles.VisualStyleInfor mation.IsEnabledByUser
3. Are themes currently enabled within the application?
System.Windows.Forms.Application.VisualStyleState
4. If all of the above are true, then what color scheme is being used
(e.g.,
Default (blue), Olive Green or Silver if the OS is Windows XP)?
System.Windows.Forms.VisualStyles.VisualStyleInfor mation.ColorScheme

Also, I have not used Windows Vista so any help with the possible color
schemes with that OS would be greatly appreciated.
Can't help you with that.
Armin

Oct 2 '07 #2
Wow, thank you both so much for the info. That was quick and a lot easier
than I expected.

Just one more question ... is there an event (or some other notification)
when the value of
System.Windows.Forms.VisualStyles.VisualStyleInfor mation.ColorScheme changes?
Of course I could just test the value during a timer's tick event, but I
wanted to see if there is a more efficient technique. I need to know when
VisualStyleInformation.ColorScheme changes so that I update my custom drawn
controls if the user changes the Windows Color Scheme while my app is running.

Thanks again!
Lance

Oct 3 '07 #3
"ljlevend2" <lj*******@nospam.nospamschrieb
Wow, thank you both so much for the info. That was quick and a lot
easier than I expected.

Just one more question ... is there an event (or some other
notification) when the value of
System.Windows.Forms.VisualStyles.VisualStyleInfor mation.ColorScheme
changes? Of course I could just test the value during a timer's tick
event, but I wanted to see if there is a more efficient technique.
I need to know when VisualStyleInformation.ColorScheme changes so
that I update my custom drawn controls if the user changes the
Windows Color Scheme while my app is running.

Thanks again!
Lance
Untested:
Subscribe to Microsoft.Win32.SystemEvents.UserPreferenceChanged . In the
handler check

If e.Category = Microsoft.Win32.UserPreferenceCategory.VisualStyle

Armin

Oct 3 '07 #4
Hello Lance,

Armin's suggestion is right. UserPreferenceChanged event is able to capture
the change of system Theme. I did a test for it:

SystemEvents.UserPreferenceChanged += new
UserPreferenceChangedEventHandler(SystemEvents_Use rPreferenceChanged);

void SystemEvents_UserPreferenceChanged(object sender,
UserPreferenceChangedEventArgs e)
{
if (e.Category == UserPreferenceCategory.VisualStyle)
{
MessageBox.Show("Changed");
}
}

Then when I change my system's theme from Windows Vista to Windows Classic,
the message box "Changed" is shown.

Thank you, Armin.

Lance, if you have any other concen or need anything else, please feel free
to let us know.

Sincerely,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 4 '07 #5
ljlevend2 schreef:
Wow, thank you both so much for the info. That was quick and a lot easier
than I expected.

Just one more question ... is there an event (or some other notification)
when the value of
System.Windows.Forms.VisualStyles.VisualStyleInfor mation.ColorScheme changes?
Of course I could just test the value during a timer's tick event, but I
wanted to see if there is a more efficient technique. I need to know when
VisualStyleInformation.ColorScheme changes so that I update my custom drawn
controls if the user changes the Windows Color Scheme while my app is running.

Thanks again!
Lance
What if the scheme is changed to another theme that the user downloaded?
--
Rinze van Huizen
C-Services Holland b.v
Oct 4 '07 #6
"Jialiang Ge [MSFT]" <ji****@online.microsoft.comschrieb
>
Thank you, Armin.
Was a pleasure. :)
Armin
Oct 4 '07 #7
Hello Rinze,

I did a test on it. The event SystemEvents.UserPreferenceChanged is still
able to capture the change of theme.

Sincerely,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 5 '07 #8
Hi Lance,

Would you mind letting me know the result of the suggestions? If you need
further assistance, feel free to let me know. I will be more than happy to
be of assistance.

Have a great day!

Sincerely,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 9 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Lenard Lindstrom | last post by:
I was wondering if anyone has suggested having Python determine a method's kind from its first parameter. 'self' is a de facto reserved word; 'cls' is a good indicator of a class method ( __new__...
17
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number....
0
by: Philippe Poulard | last post by:
I don't know if anybody already designed an URN scheme for XML; here is a proposal: I call it the "XML URN Scheme", or XUS. ========= URNs are logical names used to identify resources. XUS...
31
by: bilbothebagginsbab5 AT freenet DOT de | last post by:
Hello, hello. So. I've read what I could find on google(groups) for this, also the faq of comp.lang.c. But still I do not understand why there is not standard method to "(...) query the...
36
by: AussieRules | last post by:
Hi, I want to use the user color scheme to set the color of my forms. I now I have to use the. System.Drawing.SystemColors, but which color is the color of a form background as used in other...
2
by: Johannes | last post by:
When you do a webrequest like: Dim objWebRequest As WebRequest = WebRequest.Create(objURI) the returned class can be httpwebrequest, ftpwebrequest or any othe descendant webrequest type that is...
10
by: Pep | last post by:
I have a problem I need to solve which looks like memory exhaustion. Is there a function that I can use in c++ to determine the size of the heap before and after a allocation? The C++ code is...
4
by: Chris Davies | last post by:
I'm curious. I'd like to determine whether a particular URI scheme (the "ftp:", "news:", "http:" part) is available within the user's browser. For example, consider this HTML snippet: ...
11
by: gnuist006 | last post by:
Is there a Delphi equivalent in the C world or Scheme/LISP world ? Recently, Delphi is in resurgence. In Russia people are using like crazy. For example, Bolega has written a free image...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.