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

Get Parent Color

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
Dj_Fx8
Asked:
Dj_Fx8
1 Solution
 
bkfirebirdCommented:
try GetDC()->SetBkColor (GetParent()->GetDC()->GetBkColor ())
0
 
AlexFMCommented:
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
 
migelCommented:
Hi!
IMHO you need to send WM_CTLCOLORSTATIC to the parent and examine brush being returned.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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