Professional UI Solutions
Site Map   /  Register
 
 

Forum

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 » handling WM_PAINT message for CExtResizableDialog Collapse All
Subject Author Date
Jase Wolfe Aug 6, 2008 - 12:53 PM

I’m trying to handle WM_PAINT message in order to draw some items on the background of a dialog window.  I need the window to be drawn initially and then I’d like to be able to draw on top afterwards.


I’ve tried the message handler function OnPaint(), which executes, but gets drawn over after the function is done.  It appears as though nothing was drawn, but quick changing of the window gets the form to flicker with the drawn items.


I then handled WM_PAINT in the WindowProc function.  I can get the window to draw the items, but the parts that I’m not drawing onto end up being transparent and showing whatever is beneath the window.


What I need to happen is your drawing code to take place, then my drawing code to take place afterwards.  Is there a way to accomplish this?

Technical Support Aug 8, 2008 - 1:58 PM

You can handle the WM_PAINT message in dialog’s WindowProc() virtual method so you can paint a custom background of the dialog window only. But this background will not be inherited by dialog controls that should also be based on the dialog background. Prof-UIS supports inherited custom background painting and it’s demonstrated in the TabbedBars sample, where you can see a custom gradient background in the dialog page windows inside a one note tab page container window created as a main SDI view window and you can also turn on hurricane-like background painting shared for all the windows inside the main frame window. Please note that the inherited background painting algorithm is turned off by default. To turn it on, you should invoke the g_PaintManager->m_bCustomBackgroundInheritanceEnabled = true;. This code should executed both at startup and when the current paint manager has changed. The background painting should be handled in the CExtPaintManager::g_nMsgPaintInheritedBackground registered message as it is demonstrated in the TabbedBars sample application.