呵呵,这是Delphi5得一个新特性,就是对于菜单项,如果在Caption里面没有加入&,那么Delphi会自动为其添加一个快捷键,所以你的程序在运行时才会Caption属性才会自动改变,最好的解决办法就是你在添加菜单时,手动添加快捷键,就不会有这种问题了!

解决方案 »

  1.   

    大哥,你不会把&去掉啊!
    procedure TForm1.ItemOnClick(Sender: TObject);
    var
       str,sFileName:string;
    begin
      if (sender is Tmenuitem) then
        str:=caption;
      str:=stringreplace(str,'&','',[rfReplaceAll,rfIgnoreCase]);
      i:=pos('(',str)-1;
      if i>0 then
        sFileName:=copy(str,1,i)
      else
        sFileName:=str;
        if sFileName='other' then  
          if FontDialog1.Execute then
            Memo1.Font:=FontDialog1.Font
          else
            Memo1.Font.Name:=Caption;
      end;
    end;
      

  2.   

    Menu.AutoHotkeys := maManual;