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 » Themecolor demo only works in theme color demo not in a simple SDI project Collapse All
Subject Author Date
steven frierdich Jun 19, 2006 - 7:08 AM

I copied most the code you have in the theme color demo into a SDI project, simple2 , and still the menu, toolbars, and status bar in the simple2 project do not change colors. I see the theme color demo’s mainframe is also derived from CFrameWnd, and is the simple2 project attached in the email is. The simple project works pretty much like the theme color if not identical. Like theme color demo the paint manager is derived from a color theme class. The simple2 project’s m_pPaintManager is derived from the a class titled CColorizedThemeOffice2007 which itself is derived from your CExtPaintManagerOffice2007_R2_Obsidian class:
class CColorizedThemeOffice2007 :
    public CExtPaintManagerOffice2007_R2_Obsidian

Simple2 prohect uses a pop dialog to allow a user to change the menu, tool, bar, and status bar colors by setting thethem. The controls on the pop dialog are identical to the one in the theme color demo that changes the toolbar and menu backgrounds, along with control being the derived also from the same classes. The same functions are called in the dialog as is done in the theme color demo. The functions in the CColorizedThemeOffice2007 are identical to that in the theme color demo’s CColorizedThemeOffice2003. Simple2 project’s CMainFrame class makes static public reference point to itself available so it used when needed in the project. Just like the theme color demo, the Simple2 demo CMainFrame is also derived from CFrameWnd.

No matter what I try the Simple2 project’s toolbars, status bar, and menu background color do not change color. I even hard coded the two variables that change the projects theme color,    m_clrFillHint, and m_clrAccentHint, and that did not change the Simple2 project’s toolbars, status bar, and menu background colors. When I harded those wto variable in the theme color project the background colors of the various controls did change.

If anyone would like to take a look at the simple2 project and maybe see where the error lies, or modify it get it to work,drop me an email at sun_Water_snow@hotmail.com

Thanks
Steve

Technical Support Jun 19, 2006 - 11:03 AM

The ThemeColorizer sample is based on the Office 2003 theme which paints everything using solid fill and gradient fill techniques. All the colors in the Office 2003 theme are really based on two colors: the accent color and the fill color. That is why it was possible to create the ThemeColorizer sample based on the Office 2003 theme.

However the same is not applicable to Office 2007 themes, which are only partially based on the accent and fill colors. The Office 2007 themes widely use bitmaps from resources and hard coded methods for painting many of UI elements. That is why the colorization of the Office 2007 themes is not supported.

steven frierdich Jun 19, 2006 - 11:21 AM

Then I will ask again what I been asking for the last two weeks how exactly do I change the menu, toolbar, and status back backgrounds for the Office 2007 theme? What color variables can I set in the Office 2007 theme to have the menu, toolbar, and statusbar the color I want them? Do not tell me like you did before to overirde DoPaint and some DoPaintNC that is like 250 lines in your DLL? What good is the theme color demo if it just limeted to one theme.

Technical Support Jun 20, 2006 - 7:03 AM

Unfortunately, you cannot just set the background color with some variable. The only way is to override the painting methods like as follows:

class CMyToolControlBar : public CExtToolControlBar
{
public:
            void DoEraseBk( CDC * pDC )
            {
                        ASSERT( pDC->GetSafeHdc() != NULL );
                        CRect rcClient;
                        GetClientRect( &rcClient );
                        pDC->FillSolidRect( &rcClient, RGB(255,0,0) );
            }
};
class CMyMenuControlBar : public CExtMenuControlBar
{
public:
            void DoEraseBk( CDC * pDC )
            {
                        ASSERT( pDC->GetSafeHdc() != NULL );
                        CRect rcClient;
                        GetClientRect( &rcClient );
                        pDC->FillSolidRect( &rcClient, RGB(255,0,0) );
            }
};
class CMyStatusControlBar : public CExtStatusControlBar
{
public:
            void OnPaintEntireBackground(
                        CDC & dc,
                        const CRect & rcBk
                        )
            {
                        ASSERT_VALID( this );
                        dc.FillSolidRect( &rcBk, RGB(255,0,0) );
            }
};
These classes implement a toolbar, a menu bar and a status bar with the red background.