Set form position dynamically - Forms - Tips & Tricks - Greatis Delphi Pages

Use ClientOrigin property of the form. ClientOrigin is the screen coordinates (in pixels) of the top left corner of a control's client area. This property will help you to set your form to the specific position.


uses Unit2;
...
procedure TForm1.Button1Click(Sender: TObject);
var
NewForm: TForm2;
begin
NewForm:=TForm2.Create(nil);
try
NewForm.Left:=ActiveControl.Width+
ActiveControl.Left+
ClientOrigin.X;
NewForm.Top:=ActiveControl.Top+ClientOrigin.Y;
NewForm.ShowModal;
finally
NewForm.Release;
end;
end;

For more
Delphi Help :)) http://www.greatis.com/delphicb/formdes/

Download source

Share this

Related Posts

Previous
Next Post »