This is a very interesting idea. The CExtRibbonNodeGroup
class is used for representing button groups in the ribbon’s command tree. You need to create and use your own class derived from it and implement the CExtRibbonNodeGroup::_OnRibbonGetButtonRTC()
virtual method:
CRuntimeClass * C_YOUR_RibbonNodeGroup::_OnRibbonGetButtonRTC()
{
ASSERT_VALID( this );
return ( RUNTIME_CLASS( C_YOUR_RibbonButtonGroup ) );
}
Where the
C_YOUR_RibbonButtonGroup
is also your class derived from the
CExtRibbonButtonGroup
class:
class C_YOUR_RibbonButtonGroup : public CExtRibbonButtonGroup
{
public:
DECLARE_DYNCREATE( C_YOUR_RibbonButtonGroup );
C_YOUR_RibbonButtonGroup( CExtRibbonPage * pBar = NULL, UINT nCmdID = ID_SEPARATOR, UINT nStyle = 0 ) : CExtRibbonButtonGroup( pBar, nCmdID, nStyle ) { }
virtual void PaintCompound(
CDC & dc,
bool bPaintParentChain,
bool bPaintChildren,
bool bPaintOneNearestChildrenLevelOnly
)
{
. . .
}
};
IMPLEMENT_DYNCREATE( C_YOUR_RibbonButtonGroup, CExtRibbonButtonGroup );
The
PaintCompound()
is invoked for painting background of the group of ribbon buttons over already painted background of the ribbon page. You can copy the source code of this method from the
CExtRibbonButtonGroup::PaintCompound()
method and replace the following part of it:
GetRibbonPage()->PmBridge_GetPM()->
Ribbon_PaintGroupBk(
dc,
rcRibbonGroupButton,
this
);
With your colored implementation.