Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Office 2007 title bar buttons.

60 views
Skip to first unread message

RealCat

unread,
Aug 18, 2008, 7:22:53 PM8/18/08
to
Hello.

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.

RealCat

unread,
Aug 20, 2008, 9:46:50 AM8/20/08
to
I thought drawing on the NC area was quite a popluar subject for I
knew many applications which do that. Moreover, since the source code
MFC is provided, I thought people who could understand the structure
of MFC, could relatively easily single out the APIs to draw buttons on
the NC area. I have waited for a few days but no one has replied. Is
it very difficult to draw on the NC area under Aero?

David Ching

unread,
Aug 22, 2008, 12:13:21 AM8/22/08
to
On Aug 19, 8:22 am, RealCat <typing...@gmail.com> wrote:
> Hello.
>
> 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


0 new messages