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 Tech Support » CExtResizableDialog and OnPaint Collapse All
Subject Author Date
Wilhelm Falkner Aug 9, 2005 - 12:00 PM

Hi,
it seems to me, that OnPaint is not called when inherited from CExtResizableDialog. If I use CDialog instead, all works fine.
What I have done wrong??

TIA Willi

Dusan Gibarac Apr 14, 2007 - 6:32 PM

I have to ’paint’ on CExtResizablePropertyPage. Implementing the same WM_PAINT technique there does not work. WM_PAINT did not happened. We have in the code:

IMPLEMENT_DYNCREATE(CKWP_Computer, CExtResizablePropertyPage)

CKWP_Computer::CKWP_Computer() : CExtResizablePropertyPage(CKWP_Computer::IDD)
{
}

and

class CKWP_Computer : public CExtResizablePropertyPage
{
    DECLARE_DYNCREATE(CKWP_Computer)
protected:
virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
if( message == WM_PAINT )
{
AfxMessageBox("painting");
CPaintDC dc( this );

...

Technical Support Apr 15, 2007 - 11:16 AM

We guess the page window contains some control(s) which cover the client area of the page completely.

Technical Support Aug 10, 2005 - 12:16 PM

If you take a look at the declaration of CExtResizableDialog, you will see that its parent classes are wrapped in templates. The template classes cannot have message handlers like OnPaint() for implementing window behavior and appearance. So we had to implement the WindowProc() virtual method in them. The CExtWS template class adds a theme-based background to the resizable dialog window and eats up the WM_PAINT standard windows message in its WindowProc() method. That is why the OnPaint() method is not invoked in dialog classes derived from the CExtResizableDialog class. You can also override the WindowProc() method and handle the WM_PAINT standard windows message there:

class C_Your_Dialog : public CExtResizableDialog
{
protected:
    virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
    {
        if( message == WM_PAINT )
        {
            CPaintDC dc( this );
            // 
            // YOUR CUSTOM PAINTING CODE GOES HERE 
            //
            return 0;
        }
        return CExtResizableDialog::WindowProc( message, wParam, lParam );
    }
};

Wilhelm Falkner Aug 11, 2005 - 1:22 AM

Thanks for your help, works fine!!
Willi