Показать сообщение отдельно
  #2  
Старый 20.07.2011, 09:01
Pyro Pyro вне форума
Так проходящий
 
Регистрация: 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; 
Ответить с цитированием