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 );