>>我希望form2在我按下form1的菜单后打开,允满form1的工作区窗口,
>>而不掩盖form1的菜单
设置form2的菜单项目的GroupIndex属性,和主窗体的主菜单的GroupIndex不同就不会覆盖。
详细可以参考帮助文件的TMenuItem.GroupIndex说明
以下为节选
Identifies the logical group to which the menu item belongs.
property GroupIndex: Byte;
Description
Use GroupIndex to control how menus are merged. In applications that contain
multiple forms, items from the menus of secondary forms can be merged into the
application抯 main menu as those forms become active. MDI applications always
merge the menus of child windows with the main menu of the parent window.
By default, all menu items in a menu bar (main menu) have the same GroupIndex
value. To use GroupIndex to merge menus, set the GroupIndex value of each
successive menu item to a value equal to or greater than that of the previous
menu item.
When a menu item in a menu bar that is merged into the application's main
menu has the same GroupIndex value as a menu item in the main menu, the
menu item in the application's main menu is replaced by the corresponding
menu item. If multiple menu items in the application's main menu have the
same GroupIndex value, they can be replaced only by separate menu items
from the other form's menu that also have repeated GroupIndex values.
Thus, the first main menu item with a given value is replaced by the first
item in the second form with that value, the second item in the main form
is replaced by the second item in the second form, and so on.
When a menu item in a menu bar that is merged into the application's main
menu has a GroupIndex that falls between the GroupIndex values of two
adjacent items on the application's main menu, that menu item is inserted
between the two adjacent items. If the item's GroupIndex value is greater
than all other GroupIndex values in the application's main menu, the item
appears at the end of the main menu. If the GroupIndex value is less than
all other GroupIndex values in the application's main menu, the menu item
appears at the beginning of the main menu bar.