From: Mitch Wolberg Subject: Re: Image moving Date: 29 Apr 1999 00:00:00 GMT Message-ID: <372877C1.FAFA24F2@dnvr.uswest.net> Content-Transfer-Encoding: 7bit References: <7et53g$beo16@forums.borland.com> <371569F1.8ABCDF74@t-online.de> <372759BB.76FD119C@imprsv.com> <372778BC.6175FD88@t-online.de> Organization: Another Netscape Collabra Server User X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: borland.public.delphi.graphics Ahhh, but you can use the parent of the Image which is the panel it rests on. Here's some code. procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var p : TPanel ; begin ReleaseCapture; if Sender is TImage then p := TPanel(TImage(Sender).Parent) else p := TPanel(Sender) ; Select ( p ) ; p.Perform(WM_Syscommand,SC_Dragmove,0) end; There's actually more here than neccessary but I'm adding some sizing and selection code which isn't finished. I may just throw out the Image and draw directly to panel. I can do it by creating a DC but it would nice to add a canvas property to a TPanel. Any hints? Strangely this seems to only work with TCustomControl descendents. Anybody know why? Mitch Wolberg, RockWare, Inc. Toni Sanders wrote: > > Agreed. > If you have one image on one panel you can set the ImageMouseDown to > PanelMouseDown event, but Beno wrote he'd like to move pictures and in > this case you don't know the exact panel, unless you really want to > write x times the same code. > > Regards > Toni > > Sim Zacks schrieb: > > > > Actually the panel can be the same size as the timage, maybe a pixel > or 2 bigger, > > then you and you can call the same event if the mouse down is on the > panel or the > > image so either way the panel will move and if you always know what > you are moving > > it is easier to understand if you do not use the parent property.