Jump to content
Kevin60

Dragging and Dropping of Images

Recommended Posts

I may be passing on old news, if not then I have found out how to successfully drag and drop images in Delphi.  You do not use the existing commands concerned with drag and drop they are only used to move text from one text control to another or drag items from windows explorer.

 

You use the PTinRect command and program a response to the outcome.  The command checks if the top left corner of a control falls inside the boundary rectangle of another control.  If it does then you can identify the name of the control underneath and perform an appropriate action.  You have to create your own methods depending on the outcome but this is very easy basically IF..THEN commands.

 

It works for any control and as I discovered is the standard method used by software companies to drag and drop images.  Borland/Embarcadero never told us about this.

 

I hope this has been helpful?

Share this post


Link to post

Hi

The standard Drag&Drop events and commands work for everything in VCL as in FireMonkey (on desktop platforms). Why don't you use them for an image ?

Share this post


Link to post

Hi Patrick

Thank you for your reply 

I have returned to programming after a long absence.  I only have Delphi 7 and perhaps should have stated this in the post.  Thanks for the information about Fire monkey.

 

Kevin Jackson

Share this post


Link to post

Ok, of course things have evolve in 20 years 😉

 

If you comply with its license, try the Community Edition. It is a big boost after Delphi 7, but you'll have to migrate old projects to Unicode & other things depending on what you used.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×