
-----------------------------------
Foxhunter
Mon Jan 10, 2011 11:16 am

C# Drag and Drop Help
-----------------------------------
In C# For the final project we are making Towers of Hanoi for our game (google it if you don't know what that is)

To do this, we need a drag and drop function so we can drag the rings and drop them on the pegs. However we want to do this by having the computer recognise we are clicking on a particular ring, and then dragging it. Is there anyway to do this?

ANY help you can offer would be extremely appreciated, we are somewhat C# Incompetent, so step by step would be very nice.

In addition, how do you play music simultaneously with the code? So we can have Contra music in the background of our game.

Thanks! :)

-----------------------------------
2goto1
Mon Jan 10, 2011 11:40 am

RE:C# Drag and Drop Help
-----------------------------------
On the drag-and-drop side, if you're using WPF, this may help to get you going. It's very step-by-step, and covers concepts such as dragging visuals as well: 

http://blogs.msdn.com/b/jaimer/archive/2007/07/12/drag-drop-in-wpf-explained-end-to-end.aspx.

-----------------------------------
Foxhunter
Tue Jan 11, 2011 10:01 am

RE:C# Drag and Drop Help
-----------------------------------
The link you gave me is broken 
'The resource cannot be found'

Thanks for trying though :)

-----------------------------------
The Lone Ranger
Tue Jan 11, 2011 10:05 am

Re: C# Drag and Drop Help
-----------------------------------
By the looks of it, this Foxhunter guy sounds incredibly stupid. I think we should all do him a favour and help him out with this program. It is our duty as COMPUTER PROGRAMERS to help anyone in need. Therefore I shall call all capable programers to assemble to help this wound programming animal complete this program.

-----------------------------------
2goto1
Tue Jan 11, 2011 10:08 am

Re: RE:C# Drag and Drop Help
-----------------------------------
The link you gave me is broken 
'The resource cannot be found'

Thanks for trying though :)

http://blogs.msdn.com/b/jaimer/archive/2007/07/12/drag-drop-in-wpf-explained-end-to-end.aspx

There was an extra period at the end of the URL. The one above should work.

-----------------------------------
Foxhunter
Tue Jan 11, 2011 10:17 am

Re: RE:C# Drag and Drop Help
-----------------------------------
The link you gave me is broken 
'The resource cannot be found'

Thanks for trying though :)

http://blogs.msdn.com/b/jaimer/archive/2007/07/12/drag-drop-in-wpf-explained-end-to-end.aspx

There was an extra period at the end of the URL. The one above should work.

Thank you! Quick question, what is WPF? And how do i know if i am running it?

-----------------------------------
2goto1
Tue Jan 11, 2011 10:20 am

Re: RE:C# Drag and Drop Help
-----------------------------------


Thank you! Quick question, what is WPF? And how do i know if i am running it?

http://msdn.microsoft.com/en-us/library/ms754130.aspx

-----------------------------------
Foxhunter
Tue Jan 11, 2011 10:21 am

Re: C# Drag and Drop Help
-----------------------------------
Thanks for your assistance!

-----------------------------------
2goto1
Tue Jan 11, 2011 10:23 am

RE:C# Drag and Drop Help
-----------------------------------
It's an alternative to "win forms", it's the newest way to make desktop apps on Windows. It is easier to produce more visually appealing apps with it versus win forms, and for something like towers of hanoi, might be a good fit. 

Comparison of the two: http://stackoverflow.com/questions/202079/wpf-versus-winforms

-----------------------------------
2goto1
Tue Jan 11, 2011 10:31 am

RE:C# Drag and Drop Help
-----------------------------------
Alternatively (since you're doing c#) Microsoft provides a thing similar to Flash called Silverlight. A Silverlight app runs in your browser just like a Flash app. Silverlight UI's are also based on WPF. See http://msdn.microsoft.com/en-us/library/ff921107(v=pandp.20).aspx. 

Up to you whether you make a desktop app or a Silverlight app.

-----------------------------------
princessaegloss
Tue Jun 05, 2012 4:26 am

RE:C# Drag and Drop Help
-----------------------------------
Hi, 

I saw a nice example of towers of Hanoi done in windows forms. With drop and drag functionality on the disks. 

Have a look: 

http://www.codeproject.com/Articles/393158/Towers-of-Hanoi

-----------------------------------
mirhagk
Tue Jun 05, 2012 7:39 am

RE:C# Drag and Drop Help
-----------------------------------
@Princessaegloss, the original poster probably doesn't go on this site anymore, and if they did, they wouldn't worry about a final project due over a year ago. Thanks for the help but please try to help up to date threads. Thank you.

-----------------------------------
QuantumPhysics
Tue Jun 05, 2012 1:55 pm

RE:C# Drag and Drop Help
-----------------------------------
In msvs there is a built-in command for the drag and drop option so if you build with the windows form application in msvs you will have access to the public library of all the drag and drop functions
