Einzelnen Beitrag anzeigen

HolgerX
Online

Registriert seit: 10. Apr 2006
Ort: Leverkusen
961 Beiträge
 
Delphi 6 Professional
 
#11

AW: Formular Position speichern, Generell wenn geschlossen wird oder bei ModalResult

  Alt 25. Jan 2017, 14:04
Hmm..

@rokli

Und wenn Du mehr wie ein Formular speichern wills:

Delphi-Quellcode:
procedure FromProp_IniRead(AForm : TCustomForm);
// INI Datei einlesen
var
  Ini : TIniFile;
  tmpFormName : string;
begin
  Ini := TIniFile.Create(ChangeFileExt( Application.ExeName, '.INI' ) );
  try
    tmpFormName := AForm.Name;
    AForm.Top := Ini.ReadInteger(tmpFormName, 'Top', AForm.Top );
    AForm.Left := Ini.ReadInteger(tmpFormName, 'Left', AForm.Left );
    AForm.Height := Ini.ReadInteger(tmpFormName, 'Height', AForm.Height);
    AForm.Width := Ini.ReadInteger(tmpFormName, 'Width', AForm.Width);
    if Ini.ReadBool( tmpFormName, 'InitMax', false ) then
      AForm.WindowState := wsMaximized
    else
      AForm.WindowState := wsNormal;
  finally
    Ini.Destroy;
  end;
end;

procedure FromProp_IniWrite(AForm : TCustomForm);
// INI Datei wegschreiben
var
  Ini : TIniFile;
  tmpFormName : string;
begin
  Ini := TIniFile.Create(ChangeFileExt( Application.ExeName, '.INI' ) );
  try
    tmpFormName := AForm.Name;
    Ini.WriteInteger(tmpFormName, 'Top', AForm.Top);
    Ini.WriteInteger(tmpFormName, 'Left', AForm.Left);
    Ini.WriteInteger(tmpFormName, 'Height', AForm.Height);
    Ini.WriteInteger(tmpFormName, 'Width', AForm.Width);
    Ini.WriteBool(tmpFormName, 'InitMax', AForm.WindowState = wsMaximized );
  finally
    Ini.Destroy;
  end;
end;
  Mit Zitat antworten Zitat