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 » Match CView Background Color and Tab color (TabOneNote) Collapse All
Subject Author Date
Alfonso Bastias Feb 27, 2006 - 3:49 PM

My application is MDI Doc/View. The CChildFrame have a tab container with severals views. How can I make the background color for each View matching with the TAB (tabOneNote).
Thanks

Alfonso Bastias Feb 28, 2006 - 4:17 PM

I am trying the solution presented in the TabbedBars sample. Not working yet. My tabs included CView... my question, Do I need to override some funtion on the CMyView class (CView derived class)?
Thanks

Technical Support Mar 1, 2006 - 3:28 AM

You if your view classes are not based on any of Prof-UIS classes like CExtResizableDialog, then it is your code that is responsible for painting a consistent background. Typically a view window has a background color returned by ::GetSysColor(COLOR_WINDOW). The view background is painted automatically while handling the WM_ERASEBACKGROUND standard windows message because the view window class is registered with the solid background brush with the COLOR_WINDOW color. So, start the painting code of your view window with painting a consistent background:

if(     (! g_PaintManager->GetCb2DbTransparentMode( (CObject*)this ) )
    ||  (! g_PaintManager->PaintDockerBkgnd( true, dc, (CWnd*)this ) )
    )
{
    CRect rcClient;
    GetClientRect( &rcClient );
    if( dc.RectVisible( &rcClient ) )
        dc.FillSolidRect(
            &rcClient,
            g_PaintManager->GetColor(
                CExtPaintManager::CLR_3DFACE_OUT
                )
            );
}


Alfonso Bastias Mar 1, 2006 - 6:39 PM

Thanks for the tips.. I am close, however, the re-paint is not working. I just added another CView derived class to the TabbedBars expample. Did not worki If a ’window’ (CExtControlBar) with autohide is activades and then hided... the view is not re-painted. I guess some mensage need to be handle between the g_PaintManager and the NewView throughout the CChildView class (derived from CExtTabPageContainerOneNoteWnd)

Thanks

Technical Support Mar 2, 2006 - 6:58 AM

Could you send us the TabbedBars sample you modified so that we can quickly find out what the problem is?

Technical Support Feb 28, 2006 - 4:09 AM

The custom background in dialog pages inside a One Note tab page container is demonstrated in the TabbedBars sample. We guess the CChildView class in this sample is a kind of the tab page container window you need. The CChildView::OnMsgPaintInheritedBackground() method handles the CExtPaintManager::g_nMsgPaintInheritedBackground registered windows message and implements painting of two custom background types: a colored background consistent with a color of the selected tab item and a hurricane-like background which is also consistent with a color of the selected tab item. Please note that the custom consistent background painting feature provided by the Prof-UIS paint manager is turned off by default and, as a result, CExtPaintManager::g_nMsgPaintInheritedBackground is not sent. To enable it, just invoke this code when your application starts up and when the paint manager changes:

g_PaintManager->m_bCustomBackgroundInheritanceEnabled = true;