首页  编辑  

移动鼠标到控件

Tags: /超级猛料/Hardware.硬件相关/键盘和鼠标/   Date Created:

让鼠标移动到控件上的方法

procedure MoveMouseIntoControl(AWinControl: TWincontrol);

var

 rtControl: TRect;

begin

 rtControl := AWinControl.BoundsRect;

 MapWindowPoints(AWinControl.Parent.Handle, 0, rtControl, 2);

 SetCursorPos(rtControl.Left + (rtControl.Right - rtControl.Left) div 2,

 rtControl.Top + (rtControl.Bottom - rtControl.Top) div 2);

end;

procedure TForm1.Button1Click(Sender: TObject);

begin

 MoveMouseIntoControl(Button1);

end;