473,320 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Drag and drop operations

I put two picture boxes on my main form. I was not able
to drag and drop on any of them. Also, the AllowDrop
property is not available at design time for the picture
box.
Any advice on an easy way to implement drag and drop for
picture boxes?

Thanks
Edi.
Nov 15 '05 #1
1 1616
Hi,

Drag and drop for picture boxes works as expected, the only caveat as you
discovered is that the AllowDrop property is not available in the designer.
But you can quite happily set it in code. Then it is a matter of responding
to the relevant events.

Below is a very brief start as to handling the events, please excuse any
errors, I did not have the dev environment up to test this.

void PictureBox1_MouseDown( object sender, MouseEventArgs e )
{
DoDragDrop( PictureBox1.Image, DragDropEffects.All );
}

void PictureBox1_DragDrop( object sender, DragEventArgs e )
{
if ( e.Data.GetDataPresent( DataFormats.Bitmap ) )
{
PictureBox1.Image = e.Data.GetData( DataFormats.Bitmap );
}
}

void PictureBox1_DragEnter( object sender, DragEventArgs e )
{
if ( e.Data.GetDataPresent( DataFormats.Bitmap ) )
{
e.Effect = DragDropEffects.Copy;
}
}

Hope this helps

--
Chris Taylor
http://dotnetjunkies.com/WebLog/chris.taylor/
<an*******@discussions.microsoft.com> wrote in message
news:07****************************@phx.gbl...
I put two picture boxes on my main form. I was not able
to drag and drop on any of them. Also, the AllowDrop
property is not available at design time for the picture
box.
Any advice on an easy way to implement drag and drop for
picture boxes?

Thanks
Edi.

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: SamSpade | last post by:
There seems to be two ways to put things on the clipboard ( I don't mean different formats): SetClipboardData and OleSetClipboard If I want to get data off the clipboard do I care how it was put...
2
by: Grey | last post by:
I need to design a workflow application with C#. I want to design an UI with some workflow components which they can be drag & drop anywhere in order to design the workflow for the application...
3
by: Joe Turek | last post by:
I store images in a database instead of the filesystem. I deliver these images via a page that uses Response.OutputStream to send the bytes back to a calling page. So a given page on my site will...
1
by: Zyrthofar Blackcloak | last post by:
Hi I have a set of four radiobuttons, and I want to be able to move and copy between them using Drag&Drop operations. This works perfectly, but now I want to see the source radiobutton's .Text...
0
by: Tiraman :-\) | last post by:
Hi, i have a treeview control which handle the drag and drop operations. but when the user trying to drag a node to one of his Childs the all node is gone. so i cover this by doing If...
9
by: Mark | last post by:
hi... i have a program that opens a couple files and performs some operations on them. i wanted to modify my program so that if you drag and drop a file onto the exe via windows, it will open...
0
by: Truevision .Net | last post by:
Hi, I have a problem with drag and drop functionality when it comes to dropping pictures from sources like for example internet explorer and the webbrowser control. Dragging and dropping from...
2
by: weird0 | last post by:
i am developing an application in which i can drag and drop icons using c#. I tried out a few tutorials on code-project.com, but they don't seem to work and are too hard to understand, like the...
0
by: Itanium | last post by:
Hi all! I'm getting in some trouble with Drag and Drop operations. I have a RichTextBox inside a Form. I want to allow text moving inside the RichTextBox itself, which is achieved by simply...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.