Mega Code Archive

 
Categories / Delphi / Forms
 

Prevent mouvement of a form outside the desktop

Title: prevent mouvement of a form outside the desktop? procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin if Form1.Left then Form1.Left := 0; if Form1.Top 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;