Changing the background color of a dialog

If you want to change the background color of your dialog box, it is a very simple.

In your CTestDlg header file, declare a member variable from CBrush:

class CTestDlg : public CDialog
 CBrush m_brush; 
Then, add this line in the OnInitDialog function:

BOOL CTestDlg::OnInitDialog() 
 m_brush.CreateSolidBrush(RGB(255, 255, 255)); // color white brush 
Finally do this on the ID_CTLCOLOR handle:

HBRUSH CAboutDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
** No need to do this!
** HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

** Return the white brush.
return m_brush;
Hope this could help any fellow programmer!

Date Last Updated: February 8, 1999


  • Isabel Marant Sneakers

    Posted by CrengarnexSap on 03/28/2013 11:30am

    Hong Kong Celebrities in [url=]Isabel Marant Sneaker Wedges sale[/url] Spotted – Kelly Chen, Florinda Ho and Hillary Tsui looking onto in Isabel Marant pieces from the Spring/Summer 2012 collection. We also spotted Joey Yung at the levee IT threw in the service of Isabel while she was in community at Zuma last week. Isabel Marant Opens Third Hong Kong Store on Ice Dynasty Boulevard, Coming to Township on May 19 Interpret on how YOU can finish first in a fate to bump into rendezvous with Isabel in Hong Kong! The new, and third in Hong Kong, Isabel Marant trust in on Ice Contain Drive in Main covers an area of 570sq.ft. with the décor being a collaboration between Isabel Marant and the French construction firm ciguë. To revel the principal chance of the contemporary Ice Legislature Byway someone's cup of tea collection, the team from France has specially designed a yoke of Asian limited version risqu‚ tie-dye sneakers, merely handy at Isabel Marant Paris, Hong Kong and Beijing. Mind our gallery of the new hold in this world and how you can ally us at an unique cocktail vernissage for Isabel at Zuma on May 19. And we’re plumb wrought up to proffer a spot after one of our Butterboom readers and their old china to join us for a cocktail spree with Isabel Marant at Zuma on Saturday May 19 in the evening. You’ll be able to congruous her and take photos with her and learn more forth her plans here in Hong Kong. All you enjoy to do is respond this question in the comments below: “What year did Isabel Marant launch her [url=]isabel marant sneaker wedges[/url]? Any stable follower should be sure this and we’ll randomly pick in unison winner with the reprimand respond at noon on Thursday, May 17th and email them directly. Western bit of skirt's unalloyed and callow and rebellion: Isabel Marant 2012 qiu dong If it weren't for Isabel Marant on the design of the 2012 qiu dong is based color with darker tones, at first glance, leak b feign a child cogitate on this is designed instead of spring and summer emotionless: the embroidered neckline like weighty tablecloth, off-white bud silk, silk skirt flurry skirt is placed, and nine minutes of pants is decorated with a gold tie frail and soft. But gradually, the strong series resolve arise more elements of qiu dong: the combination of starless and dark down, rivet elements, cortex and oversize plea jacket... Isabel Marant study for this season, with ideal sticks female in the western Agreed States as the idea, the clean and still in diapers and seditious, r a unoccupied and provocative so along with the gender nature. Along with the gender environment with mutinous rebellious and striking, lean to be more in the streets is wearing Isabel Marant characterize consistent characteristics. Talk models this season makeup is sent along with the gender nature. Each set of fit out, at any days be adept to erode them in the body in the street, and the split between also can affiliation other style lamina is tasted. Interior decorator Isabel Marant curtain christen at the destruction, it illustrates the tees: the latest embroidery phnom penh another passage recreational rage of pants collocation, very ordinary T lengthy, also along with the gender you sooner a be wearing it.

  • New one

    Posted by snareenactina on 11/10/2012 06:18pm

    We are such fools! nosed The Political Economy of Independent Ukraine daddieswho meinongs resenting grimsrud itpro

  • What about ::AfxMessageBox or CWnd::MessageBox

    Posted by Legacy on 02/24/2004 12:00am

    Originally posted by: Its not a toomah!

    I want to also change the background of ::AfxMessageBox or CWnd::MessageBox.

    Can anybody here tell me how to do this?


  • Background color of dialog

    Posted by Legacy on 11/26/2003 12:00am

    Originally posted by: Aqualung

    It's much easier to do the following in the InitInstance:


    • SetDialogBkColor problem??

      Posted by break; on 07/01/2009 08:43am

      Hi, SetDialogBkColor dont work in my project, and i dont know why?? :( Any idea for this? regards break;

  • thanks a lot,and a piece of advice

    Posted by Legacy on 10/22/2003 12:00am

    Originally posted by: Alex

    I am wondering about control background color changing. Through effect I find those methods mentioned in this article can change only color of text and dialog background.If we want to change the color of control,we must override the control class indivisually and rewrite their functions like DrawItem ,etc.
    Welcome comments about this opinion.

  • Alternate simple ways to change the dialog background color

    Posted by Legacy on 09/22/2003 12:00am

    Originally posted by: Jes

    BOOL CJesDialog::OnEraseBkgnd( CDC* pDC )
    CRect rectPage;

    GetClientRect(rectPage.operator LPRECT());

    // m_brDlgColor is CBrush object and should have created
    // in OnInitDialog
    pDC->FillRect(rectPage.operator LPRECT(),
    pDC->DrawText(CString("Jes"),rectPage.operator LPRECT(),

    return TRUE;

    or simply

    void CJesDialog::OnPaint()

    CPaintDC dc(this);

    dc.FillRect(m_rectGUI.operator LPRECT(),&m_brDlgColor);

    // you may retain code for drawing Icon; But never
    // allow to call CDialog::OnPaint()

  • How to Change MessageBox Background?

    Posted by Legacy on 02/07/2003 12:00am

    Originally posted by: Anand Shah

    Hi the code mentioned does not work for Message Box's.
    Can anyone help with changing the Background color of the MessageBox.

    • How to Change MessageBox Background?

      Posted by Mark Veldt on 05/14/2004 08:07pm

      Search for Q99808 in Google. Microsoft has an example

  • I have a concern

    Posted by Legacy on 12/05/2002 12:00am

    Originally posted by: Deandrea Venon

    I need information on creating an atm application.
    The user should be able to enter deposit and withdrawal.
    In the end closing balance would be shown
    i have attempted it but it displays anassertion error. then everything in the dialog becomes blank. Please help!!

  • OK How to do it on a multi form app??

    Posted by Legacy on 05/30/2002 12:00am

    Originally posted by: javajunkie

    I have an app I would like to have the option of colors on each of 7 or 8 different forms that are CRecordViews. I can get the first form color changed but not the rest of them. I am using the OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) method. Any ideas on how to make all the forms have the background color changed?
    I know this isn't much deatil but if someone thinks they have a way I can provide the details for them.


  • How can I change check box's color and radio button color

    Posted by Legacy on 05/01/2002 12:00am

    Originally posted by: cthSon

    Button, radio and checkbox do not chang color

  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • As all sorts of data becomes available for storage, analysis and retrieval - so called 'Big Data' - there are potentially huge benefits, but equally huge challenges...
  • The agile organization needs knowledge to act on, quickly and effectively. Though many organizations are clamouring for "Big Data", not nearly as many know what to do with it...
  • Cloud-based integration solutions can be confusing. Adding to the confusion are the multiple ways IT departments can deliver such integration...

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date