给你一段代码把:用了actionList,和hotkey控件。每次通过hotkey控件改变热键,
然后保存在ini文件里,下次打开的时候,就是上次的热键了。
其实,TShortCut类型就是integer;
procedure TForm1.Button2Click(Sender: TObject);
var
ini: Tinifile;
begin
ini := Tinifile.Create('C:/1.ini');
with ini do
begin
Action1.ShortCut := HotKey1.HotKey;
WriteInteger('sec','shortCut',Action1.ShortCut);
Free;
end;
end;
在程序启动的时候从ini文件里读出快捷方式。
procedure TForm1.FormCreate(Sender: TObject);
begin
if not FileExists('C:/1.ini') then exit;
with Tinifile.Create('C:/1.ini') do
begin
action1.ShortCut := ReadInteger('sec','shortCut',0);
end;
end;