R – Menu Format is different in Windows 7 vs Windows XP for a Winforms app

menuvisual-studio-2008windows 7winforms

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?

Best Answer

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.

Related Topic