大哥,你不会把&去掉啊! 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;
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;