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 » Dynamic frame (rectangle) color Collapse All
Subject Author Date
Istvan Horgos Jul 29, 2005 - 10:05 PM

The class ’CExtPropertyGridCtrl’ has a frame (rectangle) whose line color is drown dynamic (if office2003 blue, if studio2005 grey, and so on...). How can I draw such dynamic colored frame around a ’CExtResizableDialog’? I know, how to draw a MFC picture control as frame about an dialog, but it is allways black, grey or white...


 


Thanks!

Technical Support Jul 30, 2005 - 9:50 AM

This thin border is painted by the CExtPaintManager::PaintResizableBarChildNcAreaRect() virtual method. Each CExtPropertyGridWnd tree grid window inside the CExtPropertyGridCtrl container handles the WM_NCCALCSIZE and WM_NCPAINT standard windows messages for implementing this thin border: Here is the source code of these methods:

void CExtPropertyGridWnd::OnNcCalcSize(
    BOOL bCalcValidRects,
    NCCALCSIZE_PARAMS FAR * lpncsp
    )
{
    ASSERT_VALID( this );
    bCalcValidRects;
    lpncsp->rgrc[0].left++;
    lpncsp->rgrc[0].top++;
    lpncsp->rgrc[0].right--;
    lpncsp->rgrc[0].bottom--;
}

void CExtPropertyGridWnd::OnNcPaint() 
{
    ASSERT_VALID( this );
CWindowDC dcWindow( this );
CRect rcClient, rcBar;
    GetClientRect( rcClient );
    ClientToScreen( rcClient );
    GetWindowRect( rcBar );
    rcClient.OffsetRect( -rcBar.TopLeft() );
    rcBar.OffsetRect( -rcBar.TopLeft() );
    dcWindow.ExcludeClipRect(rcClient);
CExtMemoryDC dc( &dcWindow, &rcBar );
    g_PaintManager->PaintResizableBarChildNcAreaRect(
        dc,
        rcBar,
        this
        );
}
You can also add absolutely the same thin border to your dialog window simply by using the CExtWRB < CYourDialog > type in your application instead of the simple CYourDialog type.