Menyimpan Posisi Form


Tips & Trik Delphi, Tips Belajar Delphi, Belajar Delphi Online
unit Unit1;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;

type

TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

uses IniFiles;

procedure TForm1.FormCreate(Sender: TObject);
var
INI: TIniFile;
begin
INI := TIniFile.Create(ChangeFileExt(ParamStr(0), ‘.INI’));
Top  := INI.ReadInteger(ClassName, ‘Top’, 0);
Left := INI.ReadInteger(ClassName, ‘Left’, 0);
INI.Free;
end;

procedure TForm1.FormDestroy(Sender: TObject);
var
INI: TIniFile;
begin
INI := TIniFile.Create(ChangeFileExt(ParamStr(0), ‘.INI’));
INI.WriteInteger(ClassName, ‘Top’, Top);
INI.WriteInteger(ClassName, ‘Left’, Left);
INI.Free;
end;

end.

TransCODE Software

Tinggalkan Balasan

Please log in using one of these methods to post your comment:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s