The wyDay blog is where you find all the latest news and tips about our existing products and new products to come.
Those of you who follow this blog regularly already know the tip Im sharing today. Its about the control I created a couple of years ago: VistaMenu.
Normally I would just show a menu from Windows 7 and say this is how you do it. Take the menu above, for example. Its the context menu when you right click the desktop in Windows 7. Its subtle and usable. Its less about being visually appealing than it is about being usable.
I find Windows Vista and Windows 7 menus to be aesthetically pleasing. However, not everyone would agree.
How do you judge art? Its damn near impossible to get 100% consensus. Luckily programs arent art they have utility first and style second.
Or, put more simply, if the style detracts from usability it is bad style.
Here are a couple of examples of bad menus. The following menus are tacky for the simple reason that the styling adds no extras usability. The excessive gradients and bad backgrounds distracts from the purpose of the menus:
If youve been programming with Windows Forms for any length of time, its very likely you already use MenuStrips and ContextMenuStrips. They are entirely custom-draw menus created by Microsoft and included in .NET Framework 2.0+.
However, the theme of the MenuStrip and ContextMenuStrip controls don't automatically adjust to match the Windows 7 theme. But, as you can see below, the MainMenu and ContextMenu controls do match the Windows 7 theme.
You can add MainMenu & ContextMenu to Visual Studio by right clicking the toolbox, clicking Choose Items and checking the MainMenu and ContextMenu check boxes.
If all the discussion of aesthetics was lost on you, then you should always use MainMenu for two simple reasons:
The MenuStrip and ContextMenuStrip controls are written entirely in C# and will forever look as tacky as they do now. The MainMenu and ContextMenu, however, are simple wrappers around the Windows API. This means that whenever Microsoft updates the menu API in Windows you will get all the usability improvements without lifting a finger.
Look at the screenshot below and you can see how Microsoft even changed the menu API between Windows Vista and Windows 7. The borders are sharper, the colors are tweaked, and the gradient is toned down.
Microsoft was good enough to add simple API for adding icons to menus. I wrote a .NET wrapper for this API a couple of years ago, VistaMenu. Enough chit-chat, heres how you use VistaMenu. Its open source and works with Windows 98 Windows 7.
Join me tomorrow when I talk about Windows 7 progress bars. See the full list of articles in the series.
Subscribe to our blog's RSS Feed or follow Wyatt (CEO of wyDay) on Mastodon (@wyatt@hachyderm.io) to keep up-to-date with our latest posts.
There's one thing that is always overlooked by most people, something that I believe it fits the "menus category". I'm talking about the toolbar...
You have you're awesome MainMenu control that I use everywhere I need menus and I recommend it to everyone. But there isn't a good solution for toolbars.
And thinking about it, how could there be one? There isn't a consistent look for toolbars across different Windows versions, Microsoft is always changing stuff. In Windows 7 we have the light blue toolbar in explorer which doesn't quite act as true toolbar, because it's supposed to replace the menus.
Still, if your application needs menus (or you want menus) but also needs a toolbar, what will you do? Add a toolstrip? That will look so bad...
I can't think of a solution to fix this problem cross-OS, can you? Maybe an extra day for an extra tip on your blog?
I'm currently coding a ToolStrip renderer though but as all renderers, everything will be hardcoded. And in this case, to fit the Windows 7 toolbar.
Ah yes, this is quite tough problem.
Unfortunately Microsoft doesn't expose API for this toolbar, so there's no way to write a wrapper so you can use it in your own app.
But there is the Windows 7 Ribbon API. I'll be mentioning some of the controls that wrap that API early next week.
Yes, but the Ribbon is not the best choice for everything. It does look good in Office but it doesn't work for smaller applications.
Is there any chance one could theme the context menu to look different? By different I mean a white background with more padding and Arial typefont, much like the new Google Chrome's context menu. I want to adopt the theme system wide because I honestly think that the default look of the context menu isn't very flattering.
Yes, redraw the menus in their entirety. Of course, then the menus wouldn't use the system styling.
Nice but there's one problem. When i change enabled state for the menu item, the icon was disappeared.