Title: Displaying a form over another form with exact coordinates
Question: How to display a form over another form with exact coordinates?
Answer:
I want to display a form exactly at the bottom of the TButton aligned left.
procedure TForm1.Button1Click(Sender: TObject);
var
 formTop,formLeft: Integer;
 Ctrl: TControl;
 DisplayForm: TForm;
begin
 formTop := Top;
 formLeft := Left;
 try
 DisplayForm := TForm.Create( Self );
 ctrl := Button1;
 repeat
 formTop := formTop + ctrl.Top;
 formLeft := formLeft + ctrl.Left;
 ctrl := ctrl.Parent;
 until ( ctrl is TForm );
 //You can call the Windows API function GetSystemMetrics().
 DisplayForm.Left := formLeft + 2 * GetSystemMetrics( SM_CXBORDER );
 DisplayForm.Top := formTop + 2 * GetSystemMetrics( SM_CYBORDER ) +
 Button1.Height + GetSystemMetrics( SM_CYCAPTION );
 DisplayForm.ShowModal;
 finally
 DisplayForm.Free;
 end;
end;