|
| |||||||||
| Tags: custom images, drag drop images, windows |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| Drag & Drop PictureBox
Hello, I search lot on the forum and on the blogs regarding drag and drop of images, but not really what I'm looking ... Yet it seems so simple,but not getting any clue where to start with! I would like to make Drag and drop images in Two stpes. If anyone click on an image and move the mouse, and if I release the button it stays on its new location. When I put on my image1 and image2 I release the button, then my image1 replaces image2. I come to the above two solutions as I find it very unique and very new,and I search lot for these two ideas and I know for the some extend this is possible. Your suggestions would be appreciated. Thank you |
|
#2
| |||
| |||
| Re: Drag & Drop PictureBox
I will provide you the programming stuff which will help you to understand how the drag and drop of Images performs for PictureBox. Code: public partial class Form1: Form
(
public Form1 ()
(
InitializeComponent (); //here we will initialize the content of form
)
private void pictureBox1_MouseMove (object sender, MouseEventArgs e)
(
if (Button == e. MouseButton. Left) //clicking the mouse left button event
pictureBox1. DoDragDrop (pictureBox1. Image, DragDropEffects. All);
)
private void Form1_Load (object sender, EventArgs e)
(
pictureBox2. AllowDrop = true;
)
private void pictureBox2_DragEnter (object sender, DragEventArgs e)
(
if (e. Data. GetDataPresent (DataFormats. Bitmap))
e. Effect = DragDropEffects. Copy;
else
e. Effect = DragDropEffects. None;
)
private void pictureBox2_DragDrop (object sender, DragEventArgs e)
(
if ((e. Data. GetDataPresent (DataFormats. Bitmap)))
this. pictureBox2. Picture = (Bitmap) (e. Data. GetData (DataFormats. Bitmap));
)
) |
|
#3
| ||||
| ||||
| Re: Drag & Drop PictureBox
Thank for your reply, I will test your and let you know, now I also search one program for the same on the internet. so soon it will get completed i will work on your code. I am rather developing this code for the purpose of working on the gaming stuff, as I saw your program on the head i suppose you have not mentioned the case two and is precisely that: pictureBox1 can be source and destination pictureBox2 or pictureBox2 can be source and destination pictureBox1 If it's really not possible, I am an alternative, if a PictureBox enter into any contact with another, I move the other. |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Drag & Drop PictureBox" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Drag & Drop photos to iPhone | lifewire | Portable Devices | 2 | 13-07-2009 10:20 AM |
| Example Method for Drag and Drop in ASP.NET | GUSSIE | Software Development | 3 | 07-07-2009 01:54 PM |
| Need Dos prompt to Drag and drop into Vista | Rixwel | Windows Software | 3 | 01-06-2009 04:46 PM |
| CMD drag and drop in Windows 7 | Justvicks | Operating Systems | 2 | 20-03-2009 07:36 PM |
| Can't drag & drop anymore! | FiOS Dave | Vista Help | 1 | 17-07-2008 08:22 PM |