Autor Beitrag
Calculon
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 676

Win XP Professional
Delphi 7 PE, Delphi 3 PRO
BeitragVerfasst: Mo 10.09.07 18:57 
N'abend allerseits!

Ich hab' ein Problem mit dem Ergebnis vom Speichern und Auslesen der Form Positionen und Maße:

So schreib' ich:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
  ini.WriteInteger('Form1', 'Top', Form1.Top);
  ini.WriteInteger('Form1', 'Left', Form1.Left);
  ini.WriteInteger('Form1', 'Height', Form1.Height);
  ini.WriteInteger('Form1', 'Width', Form1.Width);

und so les' ich:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
    top := Ini.ReadInteger('Form1', 'Top', 88);
    left := Ini.ReadInteger('Form1', 'Left', 66);
    height := Ini.ReadInteger('Form1', 'Height', 375);
    width := Ini.ReadInteger('Form1', 'Width', 389);

und so setz' ich:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
  Form1.Top := top;
  Form1.Left := left;
  Form1.Height := height;
  Form1.Width := width;

Wenn ich nun vor dem Beenden der Anwendung, meine Form maximiert habe, dann stimmt da was nicht:

ausblenden Quelltext
1:
2:
3:
4:
5:
[Form1]
Top=-4
Left=-4
Height=746
Width=1032

Ich hab' (an meinem Notebook) 'ne Auflösung von 1024x768. Dementsprechend seltsam sieht die "maximierte" Form nach dem Laden aus (etwas zu weit links :nixweiss: !?!). Gibt's da bessere Möglichketen die Positionen und Maße meiner Form in einer Ini zu speichern?

Gruß

Calculon
--
TProgger
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 148

XP
D6, D2007 prof
BeitragVerfasst: Mo 10.09.07 19:41 
Hi, ich handhabe das ähnlich, aber ich lege mir Variablen für die Position des Forms an (fLeft, fTop usw.)
Im onClose belege ich die Variablen mit den Werten des Forms und schreib sie in die Ini.
Einlesen der Ini geschieht vorm Create und im OnCreate stehen dann als erster "Left := fLeft; Top:=fTop...".
So klappt das bei mir ganz prima.
Auf diese Art ist das Form immer exakt da, wo es vor dem Schließen war.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 10.09.07 22:08 
Moin!

Du musst die Eigenschaft .WindowStateder Form auf wsMaximizedtesten und das separat speichern - und dann auch wiederherstellen! :idea: ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mo 10.09.07 22:11 
Hallo,

richtig :wink: , kann mich an einen alten Beitrag erinnern:

Größe der Form herausfinden

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Calculon Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 676

Win XP Professional
Delphi 7 PE, Delphi 3 PRO
BeitragVerfasst: Mo 10.09.07 23:35 
:idea: Perfecto!

Danke @all!

Gruß

Calculon
--