呵呵,参考我的程序吧.......mainmenuanywhere.exe
http://netroom.hbu.edu.cn/personal/mudeen/mainmenuanywhere.exe
需要源码的话等晚上十点之后会上传到我的FTP上

解决方案 »

  1.   

    你的FTP地址是什么??如果方便的话发到我的邮箱里吧!我主要就是想知道怎么做!当然还是要源码!!
      

  2.   

    朋友,你是不是给错我程序了??你这个程序的主菜单好象也不是建在coolbar上的吧?
      

  3.   

    将toolbar放在coolbar上,将toolbar上的每个工具按钮对应一列菜单。
    toolbar上每个按钮有一个menuitem(没记错的话)设置为一菜单项,比如:
    mnufile,然后将所有按钮的grouped设置为true,autosize设置为true,showcaption设置为true
      

  4.   

    回答过了!http://www.csdn.net/expert/topic/816/816375.xml!
    怎把ToolBar建在CoolBar上会吧!
      

  5.   

    http://netroom.hbu.edu.cn/personal/mudeen/mainmenuanywhere.zip
    下载去吧...........
      

  6.   

    procedure TMenuBar.SetMenu(const Value: TMainMenu);
    var
      i: Integer;
      Button: TToolButton;
    begin
      if FMenu = Value then exit;
      if Assigned(FMenu) then
        for i := ButtonCount - 1 downto 0 do
          Buttons[i].Free;
      FMenu := Value;
      if not Assigned(FMenu) then exit;
      for i := ButtonCount to FMenu.Items.Count - 1 do
      begin
        Button := TToolButton.Create(Self);
        try
          Button.AutoSize := True;
          Button.Grouped := True;
          Button.Parent := Self;
          Buttons[i].MenuItem := FMenu.Items[i];
        except
          Button.Free;
          raise;
        end;
      end;
      { Copy attributes from each menu item }
      for i := 0 to FMenu.Items.Count - 1 do
        Buttons[i].MenuItem := FMenu.Items[i];
    end;
    For i:=0 to MainMenu.Items.Count-1 do
    begin
      MainMenu.Items[i].Visible:=False;
    end;
      

  7.   

    问题很好解决:有个MenuBar控件,可将菜单放在其中,而MenuBar又可放在Coolbar中,所以位置就不是问题了,需要该控件的话给我发邮件[email protected]
      

  8.   

    MenuBar源代码!unit MenuBar;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      ToolWin, ComCtrls, Menus;type
      TMenuBar = class(TToolBar)
      private
        FMenu: TMainMenu;
        procedure SetMenu(const Value: TMainMenu);
      protected
        procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
      public
        constructor Create(AOwner: TComponent); override;
      published
        property EdgeBorders default [];
        property Menu: TMainMenu read FMenu write SetMenu;
      end;procedure Register;implementationprocedure Register;
    begin
      RegisterComponents('Samples', [TMenuBar]);
    end;{ TMenuBar }constructor TMenuBar.Create(AOwner: TComponent);
    begin
      inherited Create(AOwner);
      Flat := True;
      ShowCaptions := True;
      EdgeBorders := [];
      ControlStyle := [csCaptureMouse, csClickEvents, csMenuEvents, csSetCaption];
    end;procedure TMenuBar.GetChildren(Proc: TGetChildProc; Root: TComponent);
    begin
    end;procedure TMenuBar.SetMenu(const Value: TMainMenu);
    var
      i: Integer;
      Button: TToolButton;
    begin
      if FMenu = Value then exit;
      if Assigned(FMenu) then
        for i := ButtonCount - 1 downto 0 do
          Buttons[i].Free;
      FMenu := Value;
      if not Assigned(FMenu) then exit;
      for i := ButtonCount to FMenu.Items.Count - 1 do
      begin
        Button := TToolButton.Create(Self);
        try
          Button.AutoSize := True;
          Button.Grouped := True;
          Button.Parent := Self;
          Buttons[i].MenuItem := FMenu.Items[i];
        except
          Button.Free;
          raise;
        end;
      end;
      { Copy attributes from each menu item }
      for i := 0 to FMenu.Items.Count - 1 do
        Buttons[i].MenuItem := FMenu.Items[i];
    end;end.