var
dx,dy:integer;
{在edit的onmousedown和mousemove里分别写下面的东西}
procedure TForm1.Edit1MouseMove(Sender: TObject;
Shift: TShiftState;
X,
Y: Integer);
var
pt:tpoint;
begin
if ssleft in shift then
with TEdit(Sender)do
begin
pt:=ClienttoParent(point(x,y));
Top:=Top+pt.Y-DY;
Left:=Left+pt.X-DX;
DX:=pt.X;
DY:=pt.Y;
end;
end;
procedure TForm1.Edit1MouseDown(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
var
pt:tpoint;
begin
if ssleft in shift then
with TEdit(Sender)do
begin
pt:=ClienttoParent(point(x,y));
dx:=pt.X;
dy:=pt.Y;
end;
end;