views:

189

answers:

2

I have a Winforms app that was originally created in vs 2005 and that was converted to vs 2008. When running this app in Windows 7, the menus don't look like the standard menus in Windows 7 (i.e., the formatting for the menu items is different than the formatting for other applications). This applies to menus displayed on the menu bar of the application as well as the right-click context menus. FYI, I am using the System.Windows.Forms.MenuStrip and the System.Windows.Forms.ContextMenuStrip controls.

Does anyone know why the menus aren't rendering with the default Windows 7 look and feel?

A: 

If you have any OWNERDRAW items in your menus, Windows 7 will revert to a backward compatible drawing mode to avoid breaking your code. Do you override the drawing of any of the items?

John Knoeller
John, no, I am not using OWNERDRAW for the menus. I tried different values of the RenderMode property and, although it did change the menus, they still didn't look like the Windows 7 default.
OneSource
Sounds like you are triggering a compatibility hack. Do you do any nonclient message handling?
John Knoeller
John, no. Everything is basically the "out of the box" functionality. I did notice, though, that my menus look like the ones in SQL Server Management Studio for SQL Server 2008, which also look different from the standard Windows 7 menus.
OneSource
Try using spy++ to compare the window styles (and extended styles) of your window with one that has the windows 7 look. If that doesn't do it, I'm out of ideas. sorry..
John Knoeller
Thanks for trying to assist, John. Using spy++ to investigate is a good idea.
OneSource
Sure, I see Nobugz has an answer, he's probably right about this one.
John Knoeller
+2  A: 

MenuStrip uses a custom renderer, it doesn't leave it up to Windows to draw the menu. You can change the RenderMode property to System but that doesn't help, it's a pre-Win7 version of what system-drawn menus looked like. If you want Windows to render the menu then you'll have to fall back to the .NET 1.1 MainMenu component. Another way is to assign the Renderer property to your own custom renderer, not really practical.

This is also an issue with WPF, worse because it renders all the controls itself. We are quickly approaching a stage where the look-and-feel of a program is determined by the UI class library, not the operating system.

Hans Passant