2005. július 11., hétfő
Restrict the mouse movement to form
Problem/Question/Abstract:
Using the Windows API function ClipCursor, it is possible to restrict the movement of the mouse to a specific rectangular region on the screen.
Answer:
//restrict the mouse mouvement to form and release
//this restriction after a click on the 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;
Feliratkozás:
Megjegyzések küldése (Atom)
Nincsenek megjegyzések:
Megjegyzés küldése