本文整理自网络,侵删。
在delphi中,可以用WIN API锁定鼠标移动范围。
设有两个按钮,button1用来锁定范围,button2用来解除锁定,代码为:
procedure TForm1.Button1Click(Sender: TObject);var btPanel: TRect;begin btPanel := Panel1.BoundsRect; // 限制在Button2的范围 MapWindowPoints(handle, 0, btPanel, 2); // 座标换算 ClipCursor(@btPanel); // 限制鼠标移动区域end; procedure TForm1.Button2Click(Sender: TObject);begin ClipCursor(nil);end;
相关阅读 >>
在Delphi xe2和xe3开发的程序中加入管理员权限申请
Delphi tscreen 类 - 通过 screen 更换光标
Delphi下载程序并且urldownloadtofile的进度提示
Delphi sizetostr 文件大小转换kb mb gb tb
Delphi webbrowser载入自定义html内容并显示
Delphi使用spcomm没办法触发receivedata
更多相关阅读请进入《Delphi》频道 >>