L
less
Unregistered / Unconfirmed
GUEST, unregistred user!
我的mdi窗口右面还有一个treeview
我通过屏幕上当前鼠标位置减去主form再减去mdi form来得到,mdi form上的鼠标坐标
可是,位置总有偏差。以下是我的代码:
procedure TForm1.ToolbarButton972MouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
mybit:Tbitbtn;
point :Tpoint;
form:Tform;
begin
form:=screen.ActiveForm;
screen.cursor:=crdefault;
if screen.ActiveForm.name<>'Form1' then
begin
GetCursorPos(Point);
mybit:=Tbitbtn.Create(self);
mybit.Parent:=Form;
mybit.left:=point.x-form1.left-form.Left;
mybit.Top:=point.y-form1.top-form.top
end;
end;
我通过屏幕上当前鼠标位置减去主form再减去mdi form来得到,mdi form上的鼠标坐标
可是,位置总有偏差。以下是我的代码:
procedure TForm1.ToolbarButton972MouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
mybit:Tbitbtn;
point :Tpoint;
form:Tform;
begin
form:=screen.ActiveForm;
screen.cursor:=crdefault;
if screen.ActiveForm.name<>'Form1' then
begin
GetCursorPos(Point);
mybit:=Tbitbtn.Create(self);
mybit.Parent:=Form;
mybit.left:=point.x-form1.left-form.Left;
mybit.Top:=point.y-form1.top-form.top
end;
end;