API函数 ModifyMenu来实现,完成对已存在菜单中的菜单项设置的改变。函数:
BOOL ModifyMenu(HMENU hMnu,UINT uPosition,UINT uFlags,UINT uIDNewItem, LPCTSTR lpNewItem);设计一个菜单,包括两个菜单项,其Caption属性分别设置为&File和&Help。事件代码:
procedure TForm1.Form1Create(Sender: TObject);
begin
  ModifyMenu(MainMenu1.Handle,1,mf_BYPosition or mf_Popup or mf_Help,Help1.Handle,'帮助(&H)');
end;---------------//以下是DFM:
object Form1: TForm1
  Left = 192
  Top = 107
  Width = 696
  Height = 480
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  Menu = MainMenu1
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object MainMenu1: TMainMenu
    Left = 216
    Top = 16
    object File1: TMenuItem
      Caption = 'File'
    end
    object Help1: TMenuItem
      Caption = 'Help'
      object About1: TMenuItem
        Caption = 'About'
      end
    end
  end
end

解决方案 »

  1.   


    补充: 参数 mf_Help 决定菜单项位于窗口的最右端
      

  2.   

    TO:WnEunfn(斯人不语) 
    MF_HELP
    我在MSDN没有找到,它在哪里定义的
    还是我的MSDN太老了
      

  3.   

    不好意思, 发出贴子时浏览器出错, 我以为还没有发出的, 结果发重贴了.如果要在运行状态下移动菜单, 应该先参考 SDK 帮助中的 Menu Functions .
    可能使用得到菜单 API 函数有 
    AppendMenu
    ChangeMenu
    InsertMenu
    ModifyMenu
    RemoveMenu
      

  4.   

    想在程序中移动实现的话,
    用ControlBar和ToolBar组合实现