本文整理自网络,侵删。
procedure TForm1.ComboBox1Change(Sender: TObject);
var
ini:TInifile;
path,section,key:string;
begin
path := ExtractFilePath(application.ExeName)+'config.ini';
if FileExists(path) then
begin
ini:=Tinifile.Create(path);
Section := 'Config';
Key := 'ComboBox';
ini.WriteInteger(Section,Key,ComboBox1.ItemIndex);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
ini:TInifile;
path,section,key:string;
begin
path := ExtractFilePath(application.ExeName)+'config.ini';
if FileExists(path) then
begin
ini:=Tinifile.Create(path);
ComboBox1.ItemIndex := ini.ReadInteger('Config','ComboBox',0);
end;
end;
相关阅读 >>
Delphi 从listview组件中的选定行在数据库中删除
Delphi cb_addstring 与lb_addstring的区别?
Delphi 从twebbrowser webbrowser得到全部html源码
Delphi 字符串转换为16进制整数 整数转换为16进制字符串
Delphi 中让嵌入窗体的 webbrowser 控件无边框
更多相关阅读请进入《Delphi》频道 >>