Jump to content
Xtreme .Net Talk

Recommended Posts

  • *Experts*
Posted

Hey all,

 

I've 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, it's 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 form's 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 it's 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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...