When an MDI child form gets the focus, its menus replace those of the MDI form. This can make it hard to coordinate the menus that are shared among child forms and those that are unique to each form.
There are two basic approaches. First, you can put all menus used by any child form on the MDI form and then have the children hide those they do not need. Second, you can give each child its own menus, duplicating those that are shared. The first approach is appropriate when the child forms share many common menus. The second is appropriate when they have little in common.
This example demonstrates the second approach.
Click here to see the first approach.
The MDI form contains only the menu items it should display when there are no child forms. The child forms have their own menus and usually duplicate some common menus like the File menu's Exit command. Visual Basic automatically replaces the program's menus with those of the active child window.
This routine shows how Form1 calls its Black subroutine directly.
|