本文整理自网络,侵删。
在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 webbrowser1 保存文档为 .html
更多相关阅读请进入《Delphi》频道 >>