Solved

MFC: Color of dialog

Posted on 2010-09-15
3
410 Views
Last Modified: 2013-11-20
Hiya

Can anybody how to determine the RGB value, at runtime, of the background colour of a dialog? Normally, it is something like 192, 192, 192 but I want to get the value in run time just in case the user has changed the default colour to something else.

John
0
Comment
Question by:IssacJones
  • 2
3 Comments
 
LVL 31

Accepted Solution

by:
Zoppo earned 250 total points
ID: 33683613
Hi IssacJones,

you can use 'GetSysColor( COLOR_3DFACE )' to return the 'color for three-dimensional display elements and for dialog box backgrounds' (quote from MSDN) ...

Hope that helps,

ZOPPO
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 33684242
If you require the individual red, green and blue colours the following will help:

The valid range for a normal RGB color is 0 to 16,777,215 (&H00FFFFFF).  The high byte of a number in this range always equals 0; the lower 3 bytes, from  least to most significant byte, determine the amount of red, green, and blue,  respectively. The red, green, and blue components are each represented by a  number between 0 and 255 (&HFF).
For example, the value 255 (&H000000FF) represents red, the value (65280  (&H0000FF00) represents green, and the value 16711680 (&H00FF0000)  represents blue.


0
 
LVL 31

Expert Comment

by:Zoppo
ID: 33688956
Addition to Andy's comment: You can use GetRValue(), GetGValue() and GetBValue() to retrieve the single color components.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now