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 » Paint CExtResizableDialog Collapse All
Subject Author Date
delu qiu Jun 8, 2006 - 8:35 AM

Hi, I want to paint a CExtResizableDialog derived dialog, but my OnPaint() does not work.


class CSPSSelection:public CExtNCW < CExtResizableDialog>
{
.......
    // Generated message map functions
    //{{AFX_MSG(CSPSSelection)
    afx_msg void OnPaint();
.......
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()

}


BEGIN_MESSAGE_MAP(CSPSSelection, CDialog)
    //{{AFX_MSG_MAP(CSPSSelection)
.......
    ON_WM_CREATE()
    ON_WM_PAINT()
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSPSSelection message handlers
void CSPSSelection::OnPaint()
{
    CPaintDC dc(this);                        // device context for painting

    //1st fill background
    COLORREF colorBK=RGB(0,0,0);
    CBrush bkbrush;
    CRect rect;
    GetClientRect(&rect);
    bkbrush.CreateSolidBrush( colorBK);
    CDC::FromHandle(dc)->FillRect(    &rect,&bkbrush);    
}


How to make it work, and how to paint a CExtResizableDialog after apply skin?

Thanks

Technical Support Jun 8, 2006 - 11:14 AM

Please replace the CPaintDC class with CClientDC:

CPaintDC dc(this);