unit1
//...
type
TForm1=class(TForm)
MainMenu:TMainMenu;
m_file:TMenuItem;
m_open:TMenuItem;
...
end;
TMyForm= class(TForm1)
private
FChildMenu:TMainMenu;
public
procedure MergeMenu(aMenu:TMainMenu);//和childForm里的菜单合并
{实现: FChildMenu :=aMenu;
//可以对FChildMenu 处理。
MyForm.MainMenu.Merge(FChildMenu);}
procedure UnMergeMenu;
{实现: MyForm.MainMenu.Unmerge(FChildMenu);}
constructor Create(AOwner: TComponent); override;
{实现: inherited; FChildMenu :=TMainMenu.Create(self);}
destructor destroy;override;
{实现: FChildMenu.Free;inherited;}
end;
//////////////////////////
unit Unit2;
//...
type
TForm2 = class(TForm)
chileMenu:TMainMenu;
//...
end;