Autor Beitrag
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mo 14.03.05 18:04 
Was muss ich schreiben um Tcolor werte (clblack,clred etc.) in ini file zu speichern?

ausblenden Delphi-Quelltext
1:
ini.writestring('xxx','xxx',farbe);					


das geht nicht, weil farbe Tcolor und nicht string ist. was muss ich statt writestring nehmen?


Moderiert von user profile iconChristian S.: Topic aus VCL (Visual Component Library) verschoben am Mo 14.03.2005 um 18:04
Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt.
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Mo 14.03.05 18:08 
Nimm das hier:
ausblenden Delphi-Quelltext
1:
  Ini.WriteInteger('xxx', 'xxx', Integer(color));					

TColor ist eigentlich nur ein 32-Bit Integer Wert.

Gruß,
raziel

_________________
JSXGraph
mimi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Do 17.03.05 08:56 
es geht auch mit: ColorToStr bzw. StrToColor

_________________
MFG
Michael Springwald, "kann kein englisch...."
Blackheart
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 164

ME
D3Prof.-D6Standard
BeitragVerfasst: Do 17.03.05 09:08 
Bitte

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
procedure TForm1.FormCreate(Sender: TObject);
var
  Ini : TIniFile;
begin
  Ini := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'Einstellung.ini');
  with Ini do
  begin
    Memo1.Font.color := ReadInteger('Schrift','Schriftfarbe',0);
    Memo1.Font.Name:= ReadString('Schrift','Schriftname','MS SANS SERIF');
    Memo1.Font.Size := ReadInteger('Schrift','Schriftgroesse',10);
    Memo1.Font.Style:= TFontStyles(TFontStyle(ReadInteger('Schrift', 'Style', 0)));
    Width:= ReadInteger('Fenster','Breite',536);
    Height:= ReadInteger('Fenster','Hoehe',348);
    Top:= ReadInteger( 'Fenster', 'Oben', 100 );
    Left:= ReadInteger( 'Fenster', 'Links', 100 );
 if ReadBool( 'Fenster', 'Maximiert', false ) then
   WindowState := wsMaximized
  else
    WindowState := wsNormal;
   end;
 Ini.Free;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
  Ini: TIniFile;
begin
  Ini := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'Einstellung.ini');
  with Ini do
  begin
    WriteInteger('Schrift','Schriftfarbe',Memo1.Font.color);                          
    WriteString('Schrift','Schriftname',Memo1.font.name);                           
    WriteInteger('Schrift','Schriftgroesse',Memo1.Font.Size);                      
    WriteInteger('Schrift', 'Style', Integer(TFontStyle(Memo1.Font.Style)));  
    WriteInteger('Fenster','Breite',Width);
    WriteInteger('Fenster','Hoehe',Height);
    WriteInteger( 'Fenster', 'Oben', Top);
    WriteInteger( 'Fenster', 'Links', Left);
    WriteBool( 'Fenster', 'Maximiert', WindowState = wsMaximized );
  end;
 Ini.Free;
 end;
end.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Do 17.03.05 09:14 
@BlackHeart:
Ich bin da viel fauler.
Ich nehme die Komponente TFormStorage aus der rxLib. Die speichert das auch alles. :wink: