1. Computing

Restrict Mouse movement

From , former About.com Guide

Here's how to restrict the mouse movement to a form and release this restriction after a click on a form:

~~~~~~~~~~~~~~~~~~~~~~~~~
procedure TForm1.FormCreate(Sender: TObject) ;
var r : TRect;
begin
    //it would be good idea to move the
    //mouse inside the form before restriction
   r := BoundsRect;
   ClipCursor(@R) ;
end;

procedure TForm1.FormClick(Sender: TObject) ;
begin
   //always be sure to release the cursor
   ClipCursor(nil) ;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~

Delphi tips navigator:
» Get Last Day in Month
« Setting the Default Printer from code

©2013 About.com. All rights reserved.