I have just watched a video that demonstrated how to use the Office
2007 ribbon (CMFCRibbonBar) with Visual C++ 2008 Power Pack on MSDN.
Actually, I am not that interested in the ribbon bar itself, I am
interested in how they draw buttons on the title bar. I am using
Windows Vista with Aero turned on, and the demo application drew the
buttons on the title bar well. There are many sample codes on the
internet that explain how to draw nc area, but most of them were quite
old, none of them worked well with Aero turned on.
I do not use MFC, and my MFC knowledge is weak. I am afraid that even
though MFC comes with source code files, I cannot analyse them to find
out the specific part. Can someone explain how they could draw buttons
on the title bar even if Aero was turned on? I would like to know this
because I want do add "Minimize to notification area" button to my C#
application's title bar next to the good old three buttons.
Thank you for reading.
I just installed VS2008 SP1 today. If you look in
VC\atlmfc\src\mfc\afxtoolbarimages.cpp, this is the class of images that is
used to draw the NC buttons. If you search for "m_bIsDrawOnGlass" you will
see custom code for drawing on Aero.
There is a heck of a lot of custom code for Vista/Aero in this new MFC. If
you look in afxglobals.h, you will see all manner of things starting with
"Dwm" and flags for whether compositing and Aero is enabled. This is used
by the ribbon and a lot of other things to render the "Fluent UI" (Office
2007 UI).
It would take me several days to completely figure this out, but it doesn't
look like it's a simple task of "call this api" and your button will draw
correctly on Aero. The whole thing is customized. Majorly. Sorry. For
once MS was probably right when they warned not to do custom NC painting.
-- David