Today, Delphi is one of the popular desktop programming tool. There are thousand even million programmer in this world using delphi as their favorit tool. This site try to collect the examples, tips and tricks of Delphi programming. We collect, test them and redistribute the collection of delphi programming for you.

How to Make Desktop Center Form

Author: admin | Category: Form, Tips and Tricks

//With Delphi 7 we can assign the Form's Position Property to poDestopCenter in order to ake our application or form always in center position
//We can also manually set the form position by use the code inside of FormCreate event like this
 
unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form1: TForm1;
 
implementation
 
{$R *.dfm}
 
procedure TForm1.FormCreate(Sender: TObject);
begin
  Form1.Left := (screen.width - Form1.width) div 2 ;
  Form1.top := (screen.height - Form1.height) div 2;
end;
 
end.

Tags: , ,