473,386 Members | 1,828 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,386 software developers and data experts.

Drop event on a picture box

I have several picture boxes on a form. I want to be able to drag
pictures to this picture box. On the Drop how can I tell which picture
box I am dropping the picture on. Te picture Box control name or
control text would suit my needs.

Regards
Jeff
May 1 '07 #1
1 1864
"Jeff Williams" <je*******************@hardsoft.com.auwrote in message
news:13*************@corp.supernews.com...
>I have several picture boxes on a form. I want to be able to drag pictures
to this picture box. On the Drop how can I tell which picture box I am
dropping the picture on. Te picture Box control name or control text would
suit my needs.
Are you using a single DragDrop event for all your pictureboxes? In that
case, the first argument, "sender", is a reference to the control that
triggered the event, which is the picturebox in which you are dropping the
picture. Since it is of type Object, you will have to cast it into
PictureBox.

private void MyPictureBoxes_DragDrop(object sender, DragEventArgs e)
{
PictureBox dropTarget = sender as PictureBox;
if (dropTarget==null) return; //Should never happen
if (e.Data.GetDataPresent(typeof(Image))) {
Image item = (Image)e.Data.GetData(typeof(Image));
if (e.Effect == DragDropEffects.Copy ||
e.Effect == DragDropEffects.Move) {
dropTarget.Image = item;
}
}
}
May 1 '07 #2

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

Similar topics

9
by: Wang, Jay | last post by:
Hello, all, I would like to enable some text between <SPAN url="http://www.testserver.com/">WORD TO BE DRAGGED </SPAN>. I put some javascript and it will extract http://www.testserver.com/ from...
3
by: Fred R | last post by:
I'm designing an app in Access 97 that will facilitate the uploading of records and images to a website. The user selects the image thumbnails from the file system and drags them into the app....
1
by: | last post by:
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...
3
by: Z D | last post by:
Hello, BACKGROUND: ============== I've created a Windows User Control that contains an Image Control (among other controls). The user control handles the picture resize event. Whenever the...
0
by: John P. Greiner | last post by:
I am trying to drag and drop a re-sized picture from excel to my application. I can implement the drag and drop and it works fine if a user drops a picture file, but the picture when dragged from...
7
by: callawayglfr | last post by:
I am building a database in access where I have a drop down box that relates to a text box, that part I have working but when someone selects information from the first drop down I need it to limit...
1
by: ReGenesis0 | last post by:
I am doing drop-down menus for a site I'm developing (not my idea, neadless to say.) I have a nice robust Javascript that handles it, and it actually WORKS, works across browsers even! How...
8
by: ericgorr | last post by:
I have the following test page: http://ericgorr.net/test.html <html> <head><title>Simple JavaScript</title></head> <BODY ondragstart="alert(event.srcElement.tagName)"> <INPUT TYPE=text...
1
by: Jeff Williams | last post by:
I am trying to get the following to work so would like some guidance on how to achieve what I need. 1. I have a form which has a tab control. 2. On the 4th TabPage I have 5 picture boxes. 3....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.