Ich hab mal schnell was zusammengeklatscht. Ohne Gewähr.
Delphi-Quellcode:
// Lesen:
procedure TForm1.FormCreate(Sender: TObject);
var
ini: TIniFile;
ifs: Byte;
begin
ini := TIniFile.Create(IncludeTrailingPathDelimiter(ExtractFilePath(Application.ExeName)) + 'FontTest.ini');
try
ifs := Byte(Label1.Font.Style); // Default setzen
ifs := ini.ReadInteger(Text, TextStyle, ifs);
Label1.Font.Style := TFontStyles(ifs);
finally
ini.Free;
end;
end;
// Schreiben:
procedure TForm1.FormDestroy(Sender: TObject);
var
ini: TIniFile;
ifs: Byte;
begin
ini := TIniFile.Create(IncludeTrailingPathDelimiter(ExtractFilePath(Application.ExeName)) + 'FontTest.ini');
try
ifs := Byte(Label1.Font.Style);
ini.WriteInteger(Text, TextStyle, ifs);
finally
ini.Free;
end;
end;
HTH,
Uli.