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 Tech Support » CExtRibbonBar question Collapse All
Subject Author Date
tera tera Mar 9, 2009 - 12:38 AM

Hello.


I want to draw a color to a group node name.

In addition, I want to display the red frames.



Give my best regards

Technical Support Mar 9, 2009 - 11:43 AM

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.