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 » How can I change menu bar backbround color Collapse All
Subject Author Date
Artur Shingirei Jan 21, 2004 - 12:25 AM

Hello!
I did use Prof_UIS lib
for creating menu in dialog based application.
I would like to know is any opportunity to change background color of menu bar
Thank you.

Technical Support Jan 21, 2004 - 7:29 AM

Dear Artur,

To change the background color of the menu bar, please override the DoPaint() method and copy its code from CExtToolColontrolBar::DoPaint(). This CExtMenuControlBar-derived class should be used in the following way:

class CMyMenuControlBar: public CExtMenuControlBar 
{ 
    public: 
        void DoPaint( CDC *pDC ) 
        { 
            . . . 
        } 
}; // class CMyExtTabMdiWnd
Now find the line g_PaintManager->PaintControlBarClientArea(*pDC, rcClient, this ) at the beginning of DoPaint() and replace it with pDC->FillSolidRect( &rcClient, RGB(r,g,b) ). This line is responsible for the background color of the menu bar’s client area. You also need to repaint the menu bar’s non-client area via handling WM_NCPAINT (which is preferable when the menu bar is used in a frame window) or make the non-client area empty via handling WM_NCCALCSIZE (which is preferable when the menu bar is used in a dialog):
virtual LRESULT WindowProc ( UINT message, WPARAM wParam, LPARAM lParam ) 
{ 
    if( message==WM_NCCALCSIZE ) 
        return 0; // this will make non-client area empty return
    CExtMenuControlBar::WindowProc(message, wParam, lParam); 
}