Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » How to change background color of a modeless dialog box? Collapse All
Subject Author Date
Anay Kulkarni Apr 6, 2009 - 4:54 AM

Hello to all,

In my project I have created a modeless dialog box and it is inherited from "CExtResizableDialog" class. When I change color theme of my application (means LunaBlue or Obsedian or Silver etc.) background color of that modeless dialog box also changes as per color theme. But I want to give my own colors to the background of a modeless dialog box regardless of color theme selected. Means I will select any color theme but background color of a modeless dialog box will not change, it will remain same (what I have given it). Can anyone tell me how to do it? Because right now I tried to change color in "OnPaint()" of modeless dialog box class but it is not taking the given color, it is only taking color as per ProfUI color theme. So please can any one help me out?


Thanks and Regards,


Technical Support Apr 6, 2009 - 9:03 AM

It’s possible to handle a WM_PAINT message in the dialog’s WindowProc() virtual method to change the dialog background only. This will not affect the background of dialog controls. So, the right solution is to use the Prof-UIS inherited background painting feature. It’s demonstrated in the TabbedBars sample application where the dialog pages in the One Note tab page container have colored background consistent with tab item color and it’s possible to turn on the hurricane like background for entire main frame window. This feature is turned off by default. To turn it on you should invoked the g_PaintManager->m_bCustomBackgroundInheritanceEnabled = true; code and handle the CChildView::OnMsgPaintInheritedBackground registered message like demonstrated in the CExtPaintManager::g_nMsgPaintInheritedBackground and CMainFrame::OnMsgPaintInheritedBackground handler methods in the TabbedBars sample application. The inherited background painting feature is present in all the Prof-UIS versions.