放一个CheckBox和Edit[8D]
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, [red]INIFiles[/red];
procedure TForm1.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
With TINIFile.Create('a.ini')do
begin
WriteBool('MySetting', 'CheckBox1_Checked', CheckBox1.Checked);
WriteString('MySetting', 'Edit1_Text', Edit1.Text);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
With TINIFile.Create('a.ini')do
begin
CheckBox1.Checked := ReadBool('MySetting', 'CheckBox1_Checked', False);
Edit1.Text := ReadString('MySetting', 'Edit1_Text', '');
end;
end;