楼上的哥们,我指的是在自己写的控件内部,即自己写的程序,然后需要在delphi内进行注册.
TGISCustomDraw = class(TCustomControl)
private
procedure WMLButtonDown(var msg: TWMLButtonDown); message WM_LBUTTONDOWN;
end;
procedure TGISCustomDraw.WMLButtonDown(var msg: TWMLButtonDown);
var
X, Y: LongInt;
begin
inherited;
if FLoading then
Exit;
x := msg.XPos;
y := msg.YPos;
FDownPoint := Point(X, Y);
FOldPoint := FDownPoint;
if (FLoading) or (FMapTool = mtNone) then
begin
Exit;
end;
if (FMapTool = mtPan) then
begin
Cursor := crPaning;
Perform(WM_LBUTTONUP, 0, MakeLParam(X, Y));
end;
FMapMove := True;
FMoveBeginPos := ScreenToWorld(FDownPoint);
FMoveOldPos := FMoveBeginPos;
R := ClientRect;
ClipCursor(@R);//在此处鼠标锁定的不是我想指定的控件的范围,而是从屏幕的左上角开始锁定了.
end;