Archive for the ‘BetterMenu’ Category
ANN: BetterMenu 1.5.0.0
After seeing that there was only one thing left on my list and it wasn’t important I’ve decided to release BetterMenu tonight.
BetterMenu Source (156 KB)
BetterMenu Demo (126 KB)
What is BetterMenu?
BetterMenu is a component you can add to a .NET application which adds images and custom drawing to menus based on the MainMenu and ContextMenu controls. Unlike regular custom drawing of menus this component handles MDI applications with menu merging and using the MDI List menu option. Also included is a component that is used by BetterMenu to make sense of the MdiChildActivate event.
License
Copyright (c) 2004-2006, James T. Johnson
ImageIndexEditor/Converter Copyright (c) 2004, Eugene Pankov
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The images used by the menu items in the Demo application are not covered by this license which is why they are not included as separate files.
A brief how-to follows the break.
Getting closer
I have one feature left to implement and I’ll be ready to release BetterMenu. Currently the width of the Rich Menu text will actually vary depending on the resolution the form was coded at and the resolution the user is running at. Because I have to rely on Code Serialization to store the resolution the form was created at the property storing the value is public. I want to stop the end-user from changing the value since the property is smart enough to pull the right value.
This is the part I can’t figure out…yet. With a nice weekend up ahead I think I’ll take advantage of it to finish the component off and get it posted here…then I’ll start back on the SyntaxHighlighter again
Getting closer to release
The MaxDescriptionWidth is now resolution aware. Only two items left on my list of things to do before release:
- Write an MDI application to show off the menu merge, MDI List capability, and “Windows…” dialog
- Create a designer to handle the MaxDescriptionWidth property
The second item should only take an hour to implement. I have no concrete idea how long the first will take; 4-5 hours probably.
After that is done I’ll upload the source code here and begin work on yet another article…this one may even find its way to CodeProject (heh, yeah right…I’ve said that 3 times before with this project)
No new screenshots today…once the MDI app is done I’ll post one
Rich menus are done!
The menus are done!

I’m not quite ready to release this code yet though. I have one major issue I need to take into account, how do I dynamically size up what the maximum width of the rich menu should be so that it also takes into account the DPI settings on the users PC. Much like how controls get resized depending on the DPI setting, so too should the maximum width of the rich menu. But that comes tomorrow.
Taking a break
Just in case anyone was interested in the BetterMenu project over the past day or so….I’ll be taking a break from coding for a day or two while I review some material for a friend. I hope to resume the project after the weekend.
Rich menu preview
I’m going to hate myself in the morning, but I have almost got rich menu support fully added to the normal menu drawer.
My only quandry left is how to determine the optimum default maximum width for the description area? How should I scale this value so that a user with large fonts set doesn’t see an incredibly tiny description area.
I’m also not sure why there is a blank space following the Copy menu item. I’m far too tired to actually debug it right now, but I wanted to get this up tonight.

Half way there
I’ve got the textual separator almost completely implemented in both Normal and Office XP menu styles.
The highlight color isn’t 100% right, only off by a few RGB values though. Same with the separator line running underneath it. I can’t seem to figure out the text color for the separator. SystemColors.Highlight isn’t dark enough, and I can’t seem to find an alpha value for black text over the light blue highlight. As much as I hate the idea maybe I’ll need to draw black text then overlay that with a transparent SystemColors.Highlight.
Here are my results so far though:

For those that don’t want to bother reading the 4 page article I wrote about it, BetterMenu (aka MenuExtenderComponent) is a .NET windows forms component that adds menu images, office xp style menus, MDI menu and MDI merged menu support to the regular .NET Menu controls. This project is focused at .NET 1.1 applications, but should work fine in a .NET 2.0 application. I recommend using the MenuStrip components if you are using .NET 2.0 though; they offer features that aren’t available in this component (such as drawing the entire length of the main menu bar, no 1px gap around the entire menu, etc).
Returning to an old project
Its been a while since I’ve talked about programming other than work or the syntax highlighter. Recent posts over on Jensen Harris’ Office User Interface blog have got me itching to add new features to an old project of mine the MenuExtenderComponent, soon to be named BetterMenu.
His recent posts about the richer menus in Office 12 have made me want to implement some of those features into MenuC BetterMenu. Namely the Textual Separators and Rich Menus. Both would be easy to implement, I just need to dig out the code, add a couple of properties, and implement a couple methods. Hopefully I can find my latest version of the code so I don’t have to go back in and refix bugs I fixed nearly a year ago.