Solved

Get Parent Color

Posted on 2004-04-16
3
244 Views
Last Modified: 2013-11-20
Hi

I simple one which I can't figure out

I have a CMyStatic derived from a CStatic which is on a Dialog, how can I get the, CMyStatic to get the color of the dialog that its on
0
Comment
Question by:Dj_Fx8
3 Comments
 
LVL 4

Expert Comment

by:bkfirebird
ID: 10846932
try GetDC()->SetBkColor (GetParent()->GetDC()->GetBkColor ())
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 250 total points
ID: 10847872
For any dialog which draws it's background by standard way, background color is returned by function GetSysColor(COLOR_BTNFACE).
If dialog code is custom and draws itself in WM_ERASEBKGND ot WM_PAINT handlers, it's impossible to get this color by generic way.
0
 
LVL 12

Expert Comment

by:migel
ID: 10848028
Hi!
IMHO you need to send WM_CTLCOLORSTATIC to the parent and examine brush being returned.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Rewrite URL With Encoded Characters 6 78
ORA-01403: no data found 43 99
difference between String.subString() and String.subSequence() 6 194
fizzArray  challenge 1 81
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

786 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