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 » CExtTabMdiWhidbeyWnd and transparent background Collapse All
Subject Author Date
Sergio Buonanno Mar 1, 2006 - 9:40 AM

Is there a way to make the background of the TABs area of a CExtTabMdiWhidbeyWnd object transparent ? I have a dialog with a bitmap background and a TAB control; the TABs area is filled with the background color of the TAB. I don’t succeed to avoid that. I would like to have the bitmap displayed on the TABs area too.

Thanks

Technical Support Mar 2, 2006 - 6:56 AM

Yes, it is possible to paint a custom background of the tab window. Create a CExtTabMdiWhidbeyWnd-derived class which implements the OnTabWndEraseClientArea() virtual method:

void CYourTabClass::OnTabWndEraseClientArea(
    CDC & dc,
    CRect & rcClient,
    CRect & rcTabItemsArea,
    CRect & rcTabNearBorderArea,
    DWORD dwOrientation,
    bool bGroupedMode
    )
{
    ASSERT_VALID( this );
    ASSERT( dc.GetSafeHdc() != NULL );
    rcTabItemsArea;
    bGroupedMode;
    rcClient;
    ///////////////////////////////////////////////////////////
    ///// 
    ///// INSERT YOUR CODE THAT PAINTS CUSTOM BACKGROUND HERE
    /////
    ///// USE rcClient FOR PAINTING YOUR BACKGROUND
    /////
    ///////////////////////////////////////////////////////////
 
    if( !rcTabNearBorderArea.IsRectEmpty() )
    {
        CRect rcTabNearMargin = rcTabNearBorderArea;
        switch( dwOrientation )
        {
            case __ETWS_ORIENT_TOP:
                rcTabNearMargin.bottom = rcTabNearMargin.top + 1;
                rcTabNearMargin.OffsetRect(0,-1);
            break;
            case __ETWS_ORIENT_BOTTOM:
                rcTabNearMargin.top = rcTabNearMargin.bottom - 1;
                rcTabNearMargin.OffsetRect(0,1);
            break;
            case __ETWS_ORIENT_LEFT:
                rcTabNearMargin.right = rcTabNearMargin.left + 1;
            break;
            case __ETWS_ORIENT_RIGHT:
                rcTabNearMargin.left = rcTabNearMargin.right - 1;
            break;
            default:
                ASSERT( FALSE );
            break;
        }
        dc.FillSolidRect(
            &rcTabNearMargin,
            PmBridge_GetPM()->GetColor( COLOR_3DSHADOW, this )
            );
    }
}
For example, the CExtTabWhidbeyWnd class paints the entire background using the following code ( insert it in place of our comment in the code above):
dc.FillSolidRect( 
    &rcClient, 
    PmBridge_GetPM()->GetColor( COLOR_3DLIGHT, this ) 
    );
You can use the following code for painting a background consistent with Prof-UIS themes:
PmBridge_GetPM()->PaintDockerBkgnd( true, dc, this );