• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 443
  • Last Modified:

MFC: Color of dialog

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
IssacJones
Asked:
IssacJones
  • 2
1 Solution
 
ZoppoCommented:
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
 
AndyAinscowCommented:
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
 
ZoppoCommented:
Addition to Andy's comment: You can use GetRValue(), GetGValue() and GetBValue() to retrieve the single color components.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now