Search

Incorrect background for controls on a CPaneDialog by gkarracer

Closed
as Fixed Help for as Fixed

4
0
Sign in
to vote
Type: Bug
ID: 594556
Opened: 9/3/2010 1:15:58 PM
Access Restriction: Public
0
Workaround(s)
2
User(s) can reproduce this bug
In Visual Studio 2010, the controls in a CPaneDialog are painted with the wrong background color. This is easiest to see with a dialog that has a group box, check box, or radio button. These and other controls are painted with a background color that is different than the dialog's background color. Which color is used is dependent on which visual style is selected. This results in a rather ugly looking dialog.

Interestingly static text controls have the correct color.
Details (expand)

Visual Studio/Silverlight/Tooling version

Visual Studio 2010

What category (if any) best represents this feedback?

 

Steps to reproduce

Create a simple MFC project (that uses visual styles).
Create a simple dialog resource that has a group box, check box, or radio button.
In CMainFrame::OnCreate add appropriate code to instantiate a floating or docked CPaneDialog for that dialog resource.
Build and run application.
Look at the resulting pane dialog and see the background color.
Switch visual styles to see the different colors used.

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

CPaneDialog has incorrect background color on some controls.

Expected results

Default background color for the controls should match the dialog's background color.
File Attachments
File Name Submitted By Submitted On File Size  
PaneDlgSample.zip 9/7/2010 161 KB
PaneDlg-Office2007.png 9/7/2010 31 KB
PaneDlg-WinXP.png 9/7/2010 26 KB
Sign in to post a comment.
Posted by Microsoft on 9/21/2010 at 11:50 AM
Hello,

Thanks for the report. This issue has been fixed in MFC for the next major release of Visual Studio.

A possible workaround is to derive your own class from CPaneDialog and handle the WM_PRINTCLIENT message. In your handler, do the following:

LRESULT CMyPaneDialog::OnPrintClient(WPARAM wp, LPARAM lp)
{
    DWORD dwFlags = (DWORD)lp;
    if (dwFlags & PRF_ERASEBKGND)
    {
        SendMessage(WM_ERASEBKGND, wp);
    }
    return 0;
}

I hope this helps!

Pat Brenner
Visual C++ Libraries Development
Posted by gkarracer on 9/7/2010 at 10:41 AM
Interesting enough WM_CTLCOLORBTN returns the correct color brush, so somewhere else it is being overriden. As a result overriding this message to use some other brush gets ignored.
Posted by gkarracer on 9/7/2010 at 10:35 AM
I've attached a very simple sample project plus two screen shots. Each picture represents a different selected application style - one using Office 2007 (blue) and the other with Windows XP style. The background colors should match the dialog's background color, but as you can see, each style uses its own color.

This odd behavior did not exist in VS2008.
Posted by Microsoft on 9/5/2010 at 8:32 PM
Thank you for reporting this issue.
Could you please attach a demo project and some screenshots to help us reproduce this issue?
Posted by Microsoft on 9/3/2010 at 5:04 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.