W
wengmxj
Unregistered / Unconfirmed
GUEST, unregistred user!
下面这段代码,image2不到image1边缘时可以随意拖动,当image2到达image1的边缘后不能
再往相反方向拖动,谁能帮助我修改一下?
procedure TChildF.Image2MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if fdrag then
begin
if (image2.Left+image2.Width)<(image1.Left+image1.Width) then
if (image2.Left>image1.Left) then
Timage(sender).Left :=Timage(sender).Left +x-oldx;
if (image2.top+image2.height)<(image1.top+image1.height) then
if (image2.top>image1.top) then
Timage(sender).top :=Timage(sender).top +y-oldy;
end;
end;
再往相反方向拖动,谁能帮助我修改一下?
procedure TChildF.Image2MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if fdrag then
begin
if (image2.Left+image2.Width)<(image1.Left+image1.Width) then
if (image2.Left>image1.Left) then
Timage(sender).Left :=Timage(sender).Left +x-oldx;
if (image2.top+image2.height)<(image1.top+image1.height) then
if (image2.top>image1.top) then
Timage(sender).top :=Timage(sender).top +y-oldy;
end;
end;