Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 8th, 2007, 12:16 PM   #1
mattireland
Hobbyist Programmer
 
mattireland's Avatar
 
Join Date: Jul 2007
Location: Wales, United Kingdom
Posts: 190
Rep Power: 2 mattireland is on a distinguished road
Send a message via MSN to mattireland Send a message via Skype™ to mattireland
Question Dragging and Dropping

Hi,

I'm wanting to create a drag and drop of picture frames. If I like have one picture frame and I want a Message Box to come up when it is positioned over the other Picture Box. Could someone please upload a project showing me how to do this or just the code if the picture boxes are called PBox1, PBox2 e.t.c.

Many thanks!

Matt Ireland
mattireland is offline   Reply With Quote
Old Jul 9th, 2007, 8:07 AM   #2
melbolt
Hobbyist Programmer
 
melbolt's Avatar
 
Join Date: Feb 2005
Location: PA, USA
Posts: 233
Rep Power: 4 melbolt is on a distinguished road
Send a message via AIM to melbolt Send a message via Yahoo to melbolt
http://www.vb-helper.com/howto_net_drag_drop.html

I doubt anyone will create a project and do all the coding, but you could use the example provided above and modify it.

Besides the only way to learn is to do it yourself.
__________________
I have never let my schooling interfere with my education. -Mark Twain-

Xbox live gamertag: melbolt
melbolt is offline   Reply With Quote
Old Jul 9th, 2007, 11:54 AM   #3
mattireland
Hobbyist Programmer
 
mattireland's Avatar
 
Join Date: Jul 2007
Location: Wales, United Kingdom
Posts: 190
Rep Power: 2 mattireland is on a distinguished road
Send a message via MSN to mattireland Send a message via Skype™ to mattireland
Yeh - thanks. It was a bit stupid of me to get someone to do it for me. It takes all the fun out after all! I'll have a look and see how I get on. Thanks again for the link!
__________________
Matt Ireland
http://www.mattireland.org
matt@mattireland.co.uk
mattireland is offline   Reply With Quote
Old Jul 9th, 2007, 12:24 PM   #4
melbolt
Hobbyist Programmer
 
melbolt's Avatar
 
Join Date: Feb 2005
Location: PA, USA
Posts: 233
Rep Power: 4 melbolt is on a distinguished road
Send a message via AIM to melbolt Send a message via Yahoo to melbolt
you might want to think twice about putting your email address in your sig, a spambot will eat that up.
__________________
I have never let my schooling interfere with my education. -Mark Twain-

Xbox live gamertag: melbolt
melbolt is offline   Reply With Quote
Old Jul 9th, 2007, 1:07 PM   #5
mattireland
Hobbyist Programmer
 
mattireland's Avatar
 
Join Date: Jul 2007
Location: Wales, United Kingdom
Posts: 190
Rep Power: 2 mattireland is on a distinguished road
Send a message via MSN to mattireland Send a message via Skype™ to mattireland
Thanks for the advice. It's just I like people emailing me.

That must be why I've got increased spam. I'll monitor the sources.

Thanks!
__________________
Matt Ireland
http://www.mattireland.org
matt@mattireland.co.uk
mattireland is offline   Reply With Quote
Old Apr 15th, 2008, 4:35 PM   #6
beni_dude
Newbie
 
beni_dude's Avatar
 
Join Date: Apr 2008
Posts: 19
Rep Power: 0 beni_dude is on a distinguished road
Re: Dragging and Dropping

Can you find an drag and drop example of any control (in my case it text box or label) but in C#

Thanks
__________________
NULL is all around me!
beni_dude is offline   Reply With Quote
Old Apr 16th, 2008, 2:19 AM   #7
mattireland
Hobbyist Programmer
 
mattireland's Avatar
 
Join Date: Jul 2007
Location: Wales, United Kingdom
Posts: 190
Rep Power: 2 mattireland is on a distinguished road
Send a message via MSN to mattireland Send a message via Skype™ to mattireland
Re: Dragging and Dropping

http://www.codeproject.com/KB/cs/dandtutorial.aspx

or

http://www.java2s.com/Code/CSharp/GU.../Drag-Drop.htm


Any help?

Matt. I
__________________
Matt Ireland
http://www.mattireland.org
matt@mattireland.co.uk
mattireland is offline   Reply With Quote
Old Apr 16th, 2008, 5:13 AM   #8
beni_dude
Newbie
 
beni_dude's Avatar
 
Join Date: Apr 2008
Posts: 19
Rep Power: 0 beni_dude is on a distinguished road
Re: Dragging and Dropping

Thanks friend I will check out and let you know if it did the trick
__________________
NULL is all around me!
beni_dude is offline   Reply With Quote
Old Apr 16th, 2008, 10:55 AM   #9
beni_dude
Newbie
 
beni_dude's Avatar
 
Join Date: Apr 2008
Posts: 19
Rep Power: 0 beni_dude is on a distinguished road
Unhappy Re: Dragging and Dropping

Hey
Sadly I'm such a newbie that I couldn't use those examples (even when I tried to do it one by one).

What I'm trying to do is very simple, I want to be a able do drag and drop a control (label) in my form.

In the propriety of the form I enabled the allowDrag to true (I'm not sure what should be enable so I enabled the both the form and the control).

Now I want on the event of enter (I think that the right event that I need to catch, I'm looking for the event that starts when I press on the control) I want to give the the control the same location of the mouse (with its X&Y locations) and here lies the problem.

Let add me code:
Quote:
point p = new point(0, 0);

p.x = MousePosition.X;
p.y = MousePosition.Y;
//Here is the problem
label1.Location.X =p.x;
label1.Location.Y = p.y;
I created an point class that do receive the mouse location (I checked it out when I debugged) but when I try to set the control location (the label) I get this error message:

Quote:
Cannot modify the return value of 'System.Windows.Forms.Control.Location' because it is not a variable
I understand what the error message mean but I still don't know how to set the location?!
__________________
NULL is all around me!

Last edited by beni_dude; Apr 16th, 2008 at 11:07 AM.
beni_dude is offline   Reply With Quote
Old Apr 16th, 2008, 4:03 PM   #10
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 929
Rep Power: 4 lectricpharaoh will become famous soon enough
Re: Dragging and Dropping

This probably should have been in a new thread, beni, but since it's here...

Having your control, form, etc recognize drag-and-drop just means it will be alerted when the user tries to drag something onto it from somewhere else while it's running. As an example, imagine you have some picture-viewing software such as PMView running, and you drag an image file onto the program's window. It can then open up the file. WinZip can receive drag-and-drop notifications, and will respond by adding those files to an archive.

Now, it seems what you're talking about is dragging controls onto a form while you're designing it. This is something different, and you don't need to adjust any of your control properties to allow this; rather, it's how a visual forms designer works. You can drag controls onto your form, move them around, and (depending on the control) resize them.

Are you using the full version of Visual Studio? If so, what version? If not, what are you using? Perhaps you're using one of the express editions you can download free from Microsoft.
__________________
A man's knowledge is like an expanding sphere, the surface corresponding to the boundary between the known and the unknown. As the sphere grows, so does its surface; the more a man learns, the more he realizes how much he does not know. Hence, the most ignorant man thinks he knows it all. - L. Sprague de Camp
lectricpharaoh is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:43 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC