Message-ID: <3AD5BF9C.9D54CB9B@govst.edu> Date: Thu, 12 Apr 2001 09:45:48 -0500 From: Mauro Patino X-Mailer: Mozilla 4.7 [en]C-CCK-MCD NSCPCD47 (WinNT; I) X-Accept-Language: en,pdf MIME-Version: 1.0 Newsgroups: borland.public.delphi.graphics Subject: Re: move an shape References: <3ad5b983_1@dnews> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 198.17.217.129 X-Trace: dnews 987086745 198.17.217.129 (12 Apr 2001 07:45:45 -0700) Lines: 43 Path: dnews Xref: dnews borland.public.delphi.graphics:38001 "w. van teeseling" wrote: > Hi everyone, > > I wonder how I can move an object of type TShape, circle or rectangle on the > canvas from one position to another. I use to do this in Pascal with the > functions get- and putimage. Try this public { Public declarations } downX, downY: integer; end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.Shape1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin downX := X; downY := Y; end; procedure TForm1.Shape1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin // checks if left button down if ssleft in Shift then //Shift is a set begin Shape1.Top := Shape1.Top + (Y - downY); Shape1.Left := Shape1.Left + (X - downX); end; end;