
20.07.2011, 09:01
|
Так проходящий
|
|
Регистрация: 18.07.2011
Сообщения: 805
Версия Delphi: 7Lite
Репутация: 6063
|
|
можно так:
PHP код:
procedure onbegin(who: tcontrol; x, y: integer);
var
xy: txy;
begin
xy := txy.Create;
xy.x := x;
xy.y := y;
who.Tag := integer(xy);
end;
procedure onmove(who: tcontrol; x, y: integer);
var
xy: txy;
begin
if who.tag = 0 then Exit;
xy := txy(who.tag);
who.Width := who.Width - (xy.x - x);
who.Height := who.Height - (xy.y - y);
xy.x := x;
xy.y := y;
who.Tag := integer(xy);
end;
procedure onend(who: tcontrol; x, y: integer);
begin
txy(who.Tag).Free;
who.tag := 0;
end;
PHP код:
procedure TForm1.Shape1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
onbegin(Sender as tcontrol, x, y);
end;
procedure TForm1.Shape1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
onmove(Sender as tcontrol, x, y);
end;
procedure TForm1.Shape1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
onend(Sender as tcontrol, x, y);
end;
|