...prevent mouvement of a form outside the desktop?

Author: Dominik Schönberger

Category: Forms

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if 
Form1.Left <= 0 then Form1.Left := 0;
  if Form1.Top <= 0 then Form1.Top := 0;
  if Form1.Left >= Screen.Width - Form1.Width then
    
Form1.Left := Screen.Width - Form1.Width;
  if Form1.Top >= Screen.Height - Form1.Height then
    
Form1.Top := Screen.Height - Form1.Height;
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base