Home Dashboard Directory Help
Search

Incorrect background for controls on a CPaneDialog by gkarracer


Status: 

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)
view
2
User(s) can reproduce this bug

Description

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
Sign in to post a comment.
Posted by Microsoft on 4/29/2014 at 12:17 PM
Thank you for reporting this issue. This issue has been fixed in Visual Studio 2013. You can install a trial version of Visual Studio 2013 with the fix from: http://go.microsoft.com/?linkid=9832436
Posted by Y Hamiaux on 8/12/2013 at 8:56 AM
Hello Pat Brenner,

I try what you suggest in WindowProc, by looking to WM_PRINTCLIENT. The group box is draw all around and the name of it is print above (without clearing the border below it). The radio button is render all in black... !?
Posted by Y Hamiaux on 8/12/2013 at 8:14 AM
Got the same issue with VS 2010 creating CButton (button & groupbox) on a CDockablePane. Sliders and static text match the background colors but not the buttons & groupbox (which is a CButton but with different style properties).

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.
File Name Submitted By Submitted On File Size  
PaneDlg-WinXP.png 9/7/2010 26 KB
PaneDlg-Office2007.png 9/7/2010 31 KB
PaneDlgSample.zip 9/7/2010 161 KB