Extend your Menus with IExtenderProvider

Volte

Neutiquam Erro
Joined
Nov 17, 2002
Messages
2,165
User Rank
*Expert*
Hey all,

Ive made a component in VB.NET (can be used in any .NET language
though) to add icon bitmaps to your menus. It uses the IExtenderProvider
interface built into the .NET framework. This interface allows for you
to extend already existing controls on a form with a new property
(well, its actually a simulation of a property, but it works just as
well), without having to inherit the control, or make a new class
of any kind.

What this particular component does, is extends your forms MenuItem
components with an ImageIndex, and the extender component
has an ImageList property; it works quite similar to a toolbar. You
bind an existing ImageList to the extender component, and you
can give your MenuItems an image from the ImageList.

To use it, simply drop it on the form, and the menus will be extended
automatically. There is no coding involved at all, on your part.

Please PM me any bugs you find, or any comments you may have
about the component. I hope you enjoy it.


To use this component
Open the project that I have included in the ZIP file, and compile
it into a new DLL.

When you load up your Windows Forms project you wish to use
this component in, right click on your toolbox, and click Customize
Toolbox. Make sure you are on the .NET Components tab, and click
Browse. Find the DLL you compiled from my class, and add it to your project (it is normally in <Your Projects Folder>\MenuIconProvider\bin\).
You can now simply drop it on your form, and its simple from there.

Thanks to divil for the UITypeEditor class to allow for smart image
selection, and to Derek Stone for finding me the code for parsing
menu shortcuts.
toolbox. You are now free to use it in your programs.
 
Doh, forgot the attachment.

[edit]Updated attachment to include AssemblyInfo[/edit]
 

Attachments

Last edited by a moderator:
Back
Top