Delphi 用ini记录ComboBox的ItemIndex


本文整理自网络,侵删。

 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 xe中通过ftp下载文件

Delphi txt日志log

Delphi xe [dcc32 fatal error] f2039 could not create output file 问题的解决

Delphi 用文件流读取文本文件字符串的方法

Delphi中三种延时方法

Delphi屏蔽webbrowser页面中传出来的声音

Delphi模拟文件拖拽

Delphi 泛型搜索字符串数组

Delphi 高权限进程实现拖曳文件操作

winapi 字符及字符串函数(10): lstrcpy - 复制字符串

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...