Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move form without border style

how do I move a borderless form? I tried looking on the internet, but nothing. Thanks a lot.

like image 773
Giacomo King Patermo Avatar asked Jun 06 '12 19:06

Giacomo King Patermo


People also ask

How do I move a window without a border?

Hold down Alt+Space-bar and then press the M key too. Let go of all the keys. Alternatively, you can also hold Shift down and right-click on the program's icon in the taskbar, and select Move.


1 Answers

You can drag a form using any contained control, including itself.

Using the following example, you can move a form by clicking on its canvas and dragging. You could do the same with a panel on the form by putting the same code in the panel's MouseDown event, which would let you create your own pseudo caption bar.

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
const
  SC_DRAGMOVE = $F012;
begin
  if Button = mbLeft then
  begin
    ReleaseCapture;
    Perform(WM_SYSCOMMAND, SC_DRAGMOVE, 0);
  end;
end;
like image 110
Bruce McGee Avatar answered Sep 18 '22 21:09

Bruce McGee