鼠标定位(35分)

  • 主题发起人 主题发起人 zhzheng
  • 开始时间 开始时间
Z

zhzheng

Unregistered / Unconfirmed
GUEST, unregistred user!
在一个窗体显示后,如何使鼠标只能在这个窗体中移动,而不能移到此窗体这外的
某个地方,当窗本关闭后鼠标自由移动
本人急用,请高手给出源代码!!急!急!急!(35分献上)
 
var rct:trect;
rct:=self.ClientRect ;
clipcursor(@rct);
 
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,stdctrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var rtbutton2:trect;
begin
rtbutton2:=button2.BoundsRect;
mapwindowpoints(handle,0,rtbutton2,2);
clipcursor(@rtbutton2);
end;

procedure TForm1.Button2Click(Sender: TObject);
var
rtscreen:trect;
begin
rtscreen:=rect(0,0,screen.width,screen.height);
clipcursor(@rtscreen);
end;

end.
 
Thank you!!!!!!!!!!
 

Similar threads

回复
0
查看
690
不得闲
回复
0
查看
804
不得闲
回复
0
查看
1K
不得闲
后退
顶部