如何动态创建菜单???
请说明 菜单项 和 包含子菜单项的 菜单的动态创建方法!谢谢!

解决方案 »

  1.   

    加上viewtree来编辑.但功能指向你就烦了.我以前做过.
      

  2.   

    先创建一个主菜单,名称为windows
    var
      NewItem: TMenuItem;
      I : integer;
    begin
      { first create the separator }
      NewItem := TMenuItem.Create(Self);
      NewItem.Caption := '-';
      { add the new item to the Windows menu }
      Windows.Add(NewItem);
      { now create and add a menu item for each form }
      for  I := 0 to Screen.FormCount-1 do
      begin
        NewItem := TMenuItem.Create(Self);
        NewItem.Caption := Screen.Forms[I].Name;
        Windows.Add(NewItem);  end;end;