开发者

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

开发者 https://www.devze.com 2022-12-18 07:02 出处:网络
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 men开发者_如何转开发us in Win

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 men开发者_如何转开发us 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?


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.


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消