views:

808

answers:

9

I'm updating some of our legacy C++ code to use the "MFC feature pack" that Microsoft released for Visual Studio 2008. We've used the new classes to derive our application from CFrameWndEx, and are applying the Office 2007 styles to give our application a more modern appearance. This gives us gradient filled window titles, status bars etc, and the use of the ribbon toolbars.

However, our application contains some owner drawn controls, and I'd like to update these to match the color scheme used by the feature pack. Ideally I'd like to know the light and shaded toolbar colors that are currently in use.

I've had a hunt around the documentation and web and have not yet found anything. Does anyone know how to find this information out?

[Edit]

In particular we need to find out which colors are being used at runtime. You can change the appearance of your application at runtime using the new static function CMFCVisualManager::SetDefaultManager.

The following msdn page shows you what kind of styles are available, in particular the Office2007 look: link to msdn

+2  A: 

Have you looked in the MFC source code, which you'll find in something like

C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\src\mfc

Will Dean
A: 

I guess you could use your favourite image editor and pick the colors from a screen grab.

GateKiller
A: 

"I guess you could use your favourite image editor and pick the colors from a screen grab."

This is essentially what I'm doing at the moment, and I've defined a list of constants from which I pull out the colours. Doesn't seem very elegant though!

John Sibly
A: 

Looks like CMFCVisualManager offers several methods for getting color information, e.g.

CMFCVisualManager::GetSmartDockingBaseGuideColors()
CMFCVisualManager::GetToolbarHighlightColor()

Take a look at the MSDN docs for CMFCVisualManager.

Aidan Ryan
A: 

@GateKiller, the OP isn't developing an Office 2007 add-in, so the UI guidelines won't really help. It's an MFC application using the Visual C++ 2008 Feature Pack which allows MFC apps to take on the Office 2007 look and feel.

Aidan Ryan
+1  A: 

Looks like CMFCVisualManager offers several methods for getting color information, e.g.

CMFCVisualManager::GetSmartDockingBaseGuideColors() CMFCVisualManager::GetToolbarHighlightColor()

Take a look at the MSDN docs for CMFCVisualManager.

Good suggestion, but unfortunately they just return various shades of grey, when currently I'm running my application with the style CMFCVisualManagerOffice2007::Office2007_LunaBlue

Annoyingly the msdn help is "under construction" so doesn't even tell you what they are supposed to be doing!

John Sibly
A: 

Good suggestion, but unfortunately they just return various shades of grey, when currently I'm running my application with the style CMFCVisualManagerOffice2007::Office2007_LunaBlue

CMFCVisualManagerOffice2007::GetTabFrameColors - the clrFace output param is grey?

Perhaps they're all masks on top of a single base hue for each theme? Assuming you can determine which color scheme is in effect with CMFCVisualManagerOffice2007::GetStyle(), perhaps you can figure out what that hue is and then do some masking with the GetxxxColor() methods.

Aidan Ryan
A: 

afxGlobalData contains some useful information on the current colours, brushes and fonts being used by the MFC Feature Pack. In particular I use afxGlobalData.m_clrBarFace when painting my own control bar backgrounds.

(note that I am not in front of my work PC so the above syntax isn't spot on.)

Rob