Aligning a form with a button lazarus / 39-Graphics ---------------------------------------------------------------------- ironphil · 2019-12-27 15:05 I have a borderless form that I want to appear right under a button when I press it. So far I can only do it by adding numbers by trial and error. I supposed there should be reliable way to do it by only using the Left and Top properties of the different controls involved. Here is what I am doing right now: I want frmPeriodic to be align verticaly with btnPeriodic and right under it. frmMain is the main form on which btnPeriodic is located. There is a panel (pnlTop) above the area where btnPeriodic is located. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TfrmPeriodic.FormShow(Sender: TObject);begin    Left:= frmMain.Left + frmMain.btnPeriodic.Left;    Top:= frmMain.Top + frmMain.btnPeriodic.Top + frmMain.btnPeriodic.Height + frmMain.pnlTop.Height;end;     It is close but the frame is still too high and not enough to the right. ---------------------------------------------------------------------- howardpc · 2019-12-27 17:23 You could try this, though it may not work well on all platforms: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses LCLIntf, LCLType; procedure TfrmPeriodic.FormShow(Sender: TObject);begin  SetInitialBounds(frmMain.Left + frmMain.btnPeriodic.Left,                   frmMain.Top + frmMain.pnlTop.Top + frmMain.pnlTop.Height +                     frmMain.btnPeriodic.Height + GetSystemMetrics(SM_CYCAPTION),                 Width,                   Height);end; ---------------------------------------------------------------------- Martin_fr · 2019-12-27 17:29 Use ClientToScreen. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i xy := ClientToScreen(Point(btn.Left, btn.Bottom));Form.Top := xy.y;Form.Left := xy.x;