限定鼠标只能在Form内移动

procedure TForm1.Button1Click(Sender: TObject);
var
  a: TRect;
begin
  a.Left := Form1.Left;
  a.Top := Form1.Top;
  a.Right := Form1.Left + Form1.Width;
  a.Bottom := Form1.Top + Form1.Height;
  ClipCursor(@a);
end;

你可能感兴趣的:(form)