简体   繁体   中英

drag and drop picturebox

I am coding a simple solitaire game just for fun and a bit of practice but do not know how to drag and drop a card in a specified position. The card itself was set as an image in a picturebox and I guess what I want to do is to drag this picturebox and drop it in a specified position at another picturebox location.

Any advice perhaps.

Kind regards

Just add:

myPixtureBox.AllowDrop = true;

Note: This is not available at design time.

https://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.allowdrop(v=vs.110).aspx

Here's an article on the topic.

A Simple Drag And Drop How To Example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM