procedure TForm1.Panel1DragDrop(Sender, Source: TObject; X, Y: Integer); begin WITH Source AS TImage DOBEGINLeft := X;Top := Y;END;end; procedure TForm1.Panel1DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);begin Accept := Source IS TImage;end; procedure TForm1.FormCreate(Sender: TObject); begin WITH TImage.Create(Self) DOBEGINParent := Panel1;AutoSize := True;Picture.LoadFromFile('D:\DELPHI\IMAGES\CHIP.BMP');DragMode := dmAutomatic;OnDragOver := Panel1DragOver;OnDragDrop := Panel1DragDrop;END;end; |
[000651]