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 » change color in Collapse All
Subject Author Date
Borremans Pierre Nov 2, 2009 - 1:02 AM

How to change the color o the menu and the statusbar ? I overdrive the class CExtPaintManagerOffice2007_R2_Obsidian but which value I must change ?

Technical Support Nov 5, 2009 - 2:50 AM

This can be done by overriding the CExtPaintManager::PaintMenuItem() virtual method. Change the CExtPaintManager::PAINTMENUITEMDATA::m_clrForceMenuText value. Invoke the parent class method with modified value.

Override the CExtPaintManager::StatusBar_PaintPane() virtual method and invoke the parent class method with a desired text color value.

Technical Support Nov 2, 2009 - 11:13 AM

The CExtPaintManager::PaintMenuItem() virtual method uses a reference to the CExtPaintManager::PAINTMENUITEMDATA data structure as a parameter. The CExtPaintManager::PAINTMENUITEMDATA::m_clrForceMenuText property allows you to change the menu text color.
The CExtPaintManager::StatusBar_PaintPane() virtual method draws the status bar pane. The clrText parameter of this method specifies the text color.
You can override these virtual methods and invoke the parent class methods with specifying required text colors.

Borremans Pierre Nov 4, 2009 - 1:12 AM

thanks for your answer but how to modifiy the background color ?

Borremans Pierre Nov 30, 2009 - 8:54 AM

ok and how to change the text color of the header item in  my main menu ?

Technical Support Nov 30, 2009 - 1:31 PM

The top level menu is the menu bar. This is the CExtMenuControlBar class in Prof-UIS. The CExtMenuControlBar menu bar control is based on the CExtToolControlBar toolbar control. The menu bar implements the top menu level as a set of toolbar items with submenus. The toolbar/menu bar buttons are instances of the CExtBarButton objects. You need to code your CExtBarButton-derived class which paints text using some preferred text color and make the menu bar using your toolbar buttons. Here is how your menu bar button class should look like:

class CYourMenuBarButton : public CExtBarButton
{
public:
            CYourMenuBarButton(
                        CExtToolControlBar * pBar = NULL,
                        UINT nCmdID = ID_SEPARATOR,
                        UINT nStyle = 0
                        )
                        : CExtBarButton( pBar, nCmdID, nStyle )
            {
            }
            virtual ~CYourMenuBarButton()
            {
            }
            void CExtBarButton::PaintCompound(
                        CDC & dc,
                        bool bPaintParentChain,
                        bool bPaintChildren,
                        bool bPaintOneNearestChildrenLevelOnly
                        )
            {
                        ASSERT_VALID( this );
                        ASSERT_VALID( (&dc) );
                                    ASSERT( dc.GetSafeHdc() != NULL );
            CExtToolControlBar * pBar = GetBar();
                        ASSERT_VALID( pBar );

                        if( ! IsPaintAble( dc ) )
                                    return;
                        if( AnimationClient_StatePaint( dc ) )
                                    return;
                        if( bPaintParentChain )
                                    PaintParentChain( dc );

                        CWnd * pCtrl = CtrlGet();
                        if(                     ( pCtrl != NULL )
                                    &&        (           ( ! m_bVertDocked )
                                                ||           GetCtrlVisibleVertically()
                                                )
                                    )
                                    return;

                        CRect rcArea( m_ActiveRect );
                        if(                     rcArea.right <= rcArea.left
                                    ||           rcArea.bottom <= rcArea.top
                                    )
                                    return;
                        if(                     (! IsVisible() )
                                    ||           (GetStyle() & TBBS_HIDDEN) != 0
                                    ||           (! dc.RectVisible(&m_ActiveRect) )
                                    )
                                    return;
                        bool bDockSiteCustomizeMode =
                                    pBar->_IsDockSiteCustomizeMode();
                        bool bPushed =
                                    ( IsPressed() && (!bDockSiteCustomizeMode) )
                                                ? true : false;
                        bool bEnabled =
                                    ( IsDisabled() && (!bDockSiteCustomizeMode) )
                                                ? false : true;
                        bool bHover =
                                    ( IsHover() && (!bDockSiteCustomizeMode) )
                                                ? true : false;
                        if(                     (! bDockSiteCustomizeMode )
                                    &&        (! GetBar()->IsForceHoverWhenMenuTracking() )
                                    )
                        {
                                    if(                     CExtToolControlBar::g_bMenuTracking
                                                ||           CExtPopupMenuWnd::IsMenuTracking()
                                                )
                                                bHover = false;
                                    else if( !bHover )
                                                bHover = IsPressedTracking();
                                    //if( bPushed && bHover && IsPressedTracking() )
                                                //bHover = false;
                        } // if( ! bDockSiteCustomizeMode ...

                        bool bIndeterminate =
                                    ( IsIndeterminate() && (!bDockSiteCustomizeMode) )
                                                ? true : false;
                        CExtSafeString sText = GetText();

                        CExtCmdIcon * pIcon = GetIconPtr();
                        CExtCmdIcon * pIconLarge = NULL;
                        if(                     pIcon != NULL
                                    &&        (! pIcon->IsEmpty() )
                                    &&        IsLargeIcon()
                                    )
                        {
                                    CSize _sizeIcon = pIcon->GetSize();
                                    _sizeIcon.cx *= 2;
                                    _sizeIcon.cy *= 2;
                                    pIconLarge = new CExtCmdIcon;
                                    if(         pIconLarge->CreateScaledCopy(
                                                            *pIcon,
                                                            _sizeIcon
                                                            )
                                                )
                                                pIcon = pIconLarge;
#ifdef _DEBUG
                                    else
                                    {
                                                ASSERT( FALSE );
                                    }
#endif // _DEBUG
                        }
                        bool bPaintAsDropDown = IsPaintDropDown();
                        bool bHorz = IsHorzBarOrientation();
                        HFONT hFont =
                        (HFONT) pBar
                                    -> OnGetToolbarFont( ! bHorz, false )
                                    -> GetSafeHandle();
                        CExtPaintManager::PAINTPUSHBUTTONDATA _ppbd(
                                    this,
                                    bHorz,
                                    rcArea,
                                    sText,
                                    pIcon,
                                    true,
                                    bHover,
                                    bPushed,
                                    bIndeterminate,
                                    bEnabled,
                                    m_bDrawBorder,
                                    false,
                                    false,
                                    0,
                                    hFont,
                                    bPaintAsDropDown,
                                    0,
                                    (!bEnabled) || ( bEnabled && (!bHover) && (!bPushed) )
                                    );

                        _ppbd.m_rcBorderSizes = OnQueryBorderSizes( bHorz );
                        _ppbd.m_nIconAlignment = OnQueryAlignmentIcon( bHorz );
                        _ppbd.m_nTextAlignment = OnQueryAlignmentText( bHorz );
                        _ppbd.m_rcIconMargins = OnQueryMarginsIcon( bHorz );
                        _ppbd.m_rcTextMargins = OnQueryMarginsText( bHorz );

                        if( OnQueryMaxButtonWidth( bHorz ) >= 0 )
                                    _ppbd.m_bWordBreak = true;    

                        if( GetSeparatedDropDown() )
                        {
                                    _ppbd.m_bSeparatedDropDown = true;
                                    _ppbd.m_bHoverDropDown = m_bDropDownHT;
                                    if(                     ( m_bDropDownHT /*|| CExtToolControlBar::g_bMenuTracking*/ )
                                                &&        bPushed
                                                &&        ( ! bDockSiteCustomizeMode )
                                                )
                                    {
                                                //_ppbd.m_bPushed = false;
                                                _ppbd.m_bPushedDropDown = true;
                                    }
                        }

                        _ppbd.m_clrCustomAccentEffectForIcon =
                                    OnQueryCustomAccentEffectForIcon( dc );

                        bool bChecked =
                                    ( (GetStyle()&TBBS_CHECKED) != 0 ) 
                                                ? true 
                                                : false;
                        _ppbd.m_bChecked = bChecked;

                        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                        //
                        // TO-DO: specify your desired text colors here
                        //
                        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                        _ppbd.m_clrForceTextNormal = RGB(255,0,0);
                        _ppbd.m_clrForceTextHover = RGB(255,0,0);
                        _ppbd.m_clrForceTextPressed = RGB(255,0,0);
                        _ppbd.m_clrForceTextDisabled = RGB(255,0,0);
                        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                        pBar->PmBridge_GetPM()->PaintPushButton( dc, _ppbd );

#if (!defined __EXT_MFC_NO_CUSTOMIZE)
                        CExtCustomizeSite * pSite = pBar->GetCustomizeSite();
                        if(                     pSite != NULL
                                    &&        pSite->IsCustomizeMode()
                                    &&        pSite->CustomizedNodeGet() != NULL
                                    &&        pSite->CustomizedNodeGet() == GetCmdNode( false )
                                    )
                        {
                                    pBar->PmBridge_GetPM()->PaintDragSourceRect(
                                                dc,
                                                rcArea
                                                );
                        }
#endif // (!defined __EXT_MFC_NO_CUSTOMIZE)

                        if( pIconLarge != NULL )
                                    delete pIconLarge;

                        if( bPaintChildren )
                                    PaintChildren( dc, bPaintOneNearestChildrenLevelOnly );
            }
};

And here is how your menu bar class should look like:
class CYourMenuBar : public CExtMenuControlBar
{
public:
            CYourMenuBar()
            {
            }
            virtual ~CYourMenuBar()
            {
            }
            CExtBarButton * OnCreateBarCommandBtn( UINT nCmdID,  UINT nStyle = 0 )
            {
                        ASSERT_VALID( this );
                        CExtBarButton * pTBB = new CYourMenuBarButton( this, nCmdID, nStyle );
                        ASSERT_VALID( pTBB );
                        return pTBB;
            }
};