0

I have created a simple propertySheet(CPropertySheet) and a couple of CPropertyPage derived classes.

While running the application, the ProperySheet, Page and tabs are appeared in white color.

I was expecting them to be like normal widow dialog color.

Any clue to make the property sheet, pages background to be like other normal MFC dialogs appears?

I use Visual Studio 2008 MFC without .NET CLR.

3 Answers 3

1

What do you mean 'system color'? Grey (COLOR_BTNFACE) ? What OS are you on? If XP the property sheet should be in COLOR_BTNFACE , Vista/Win7 I don't know what the proper color is. If you don't do anything special, they will show in the system default colors.

2
  • For me, the property sheet and pages background are in white color. Any clue?
    – user90150
    Apr 27, 2010 at 11:40
  • 1
    Yes you said that in your question. Read my answer, try to understand what it says, answer questions to get anywhere. Just repeating the information that was already in your original question isn't going to get us anywhere.
    – Roel
    Apr 27, 2010 at 12:11
0

This is a MFC bug. Use the spy++ monitor your app, you will find your app receives many WM_GETDLGCODE message, and seems enter a dead loop. Yeah, that is the problem.

Microsoft had post a PRB for the problem. please view:PRB: Child CPropertySheet Hangs If Focus Is Switched

In short, add WS_EX_CONTROLPARENT style to your PropertySheet.

   BOOL CMySheet::OnInitDialog()
   {
             ModifyStyleEx (0, WS_EX_CONTROLPARENT);
             return CPropertySheet::OnInitDialog();
   }
0

Process the WM_CTLCOLORDLG message.

case WM_CTLCOLORDLG:
   {
      HDC hdc = (HDC)wParam;
      COLORREF color = GetSysColor(COLOR_3DFACE);
      SetBkColor(hdc, color);
      static HBRUSH brush = CreateSolidBrush(color);
      return (BOOL)brush;
   }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.