Adding menu icons to MDI projects with multiple child menus
A demonstration of using the IconMenu control with MDI forms
This project demonstrates how to use the new NewMDIMenu event in the IconMenu control
to provide iconised menus in MDI projects with child forms which have their own menus.
Whenever the menu in the MDI form changes due to a new child form with its own menu being loaded,
the IconMenu control will raise the NewMDIMenu event. At this stage you can inform the
child form that the IconMenu control has detected that the menu has changed and it should
set up all the items in the menu. The child form should respond by calling the SubClassMenu
method and then setting up the icons it wants.
When a child form with its own menu is unloaded, it should call the UnSubClassMenu
method. This ensures that any extra menu items which were created by the child form are cleared up.
If you don't create any new menu items whilst the child form is running, it won't matter whether
you call this method. If you do, but fail to call it, the menus you have created will not
be destroyed until the application ends. This would leads to a small (but ultimately disastrous
if you left the project running long enough and kept opening and closing child forms) resource leak.
|