Solved

Get Parent Color

Posted on 2004-04-16
3
246 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Complete beginner needs help making a cron job 9 125
wait notify demo infinite loop 3 125
Fibonacci challenge 11 133
Capture logon name 13 88
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

808 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