Dragging and Dropping with VB.NET
Dragging and Dropping with VB.NET
Dragging and Dropping with VB.NET
Dragging and Dropping with VB.NET
Dragging and Dropping with VB.NET
Dragging and Dropping with VB.NET Dragging and Dropping with VB.NET Dragging and Dropping with VB.NET Dragging and Dropping with VB.NET Dragging and Dropping with VB.NET Dragging and Dropping with VB.NET Dragging and Dropping with VB.NET Dragging and Dropping with VB.NET
Dragging and Dropping with VB.NET Dragging and Dropping with VB.NET
Dragging and Dropping with VB.NET
Go Back  Xtreme Visual Basic Talk > > > > Dragging and Dropping with VB.NET


Reply
 
Thread Tools Display Modes
  #1  
Old 04-30-2004, 11:33 AM
Iceplug's Avatar
IceplugDragging and Dropping with VB.NET Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Smile Dragging and Dropping with VB.NET


Dragging and Dropping controls on a form!
Check out the attached solution:

Main points:
Set your destination's .AllowDrop to True
In your source's Mousedown, call its .DoDragDrop event.
In the destination's .DragEnter event, check for .GetDataPresent and set the e.Effect.
In the .DragDrop event, it is done!

In the attached solution:
Throw an ant into a timeless vortex!

Edit: You also might notice that the .DoDragDrop event pauses execution.
Attached Files
File Type: zip DragDrop.zip (9.2 KB, 825 views)
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!

Last edited by Iceplug; 05-03-2004 at 05:55 PM.
Reply With Quote
  #2  
Old 05-03-2004, 06:56 PM
Iceplug's Avatar
IceplugDragging and Dropping with VB.NET Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Smile DragDrop with Movement

Here's an example that supports dragging and dropping that actually moves the shapes to where you drag them...

the first method assigning e.X and e.Y in the DragDrop to the picturebox location... well, it "works", but it's wrong.

A more proper method would be to turn the e.X and e.Y into a Point and then use the form's .PointToClient method to get the right location.

Check out the attachment.
Attached Files
File Type: zip DragDrop2.zip (10.5 KB, 643 views)
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #3  
Old 05-11-2004, 02:20 PM
Iceplug's Avatar
IceplugDragging and Dropping with VB.NET Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Wink Three more examples

Here are three examples of drag dropping.
If you are going to peruse them... go through them in order.
It's more fun that way.

DragDrop3:
This illustrates how to move the drag dropped picturebox to the destination with the most realistic drag drop... you take the point where the user clicked on the image, and when they drop the image, you move the image with respect to this point, so that the image appears under the mouse at the same position it was when they clicked on it.

DragDrop4:
This shows how to drag multiple objects onto multiple drag drop targets (and I use the DragLeave event). I also create several pictureboxes at run time so it looks neat and it looks like a control array.

DragDrop5:
This one shows you how you can use the effects to make a Copy or a Move effect depending on if the user is pressing down the Ctrl button. If the control button is pressed, you get the copy effect and see the copy mouse cursor... if not, then you get the regular move.

Have fun... more examples coming soon.
Attached Files
File Type: zip DragDrop3.zip (9.3 KB, 819 views)
File Type: zip DragDrop4.zip (9.9 KB, 611 views)
File Type: zip DragDrop5.zip (7.5 KB, 597 views)
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
Reply


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dragging and dropping of files. FacJoe API 0 11-09-2003 04:13 AM
Dragging and dropping with buttons Digby General 1 04-30-2003 08:25 AM
Dragging and Dropping adrianosmond General 5 11-25-2002 07:54 AM
TreeView - Dragging and Dropping a node in the middle of a level rlgilby General 0 08-09-2002 08:52 AM
dragging and dropping david369 General 3 04-22-2001 01:49 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Dragging and Dropping with VB.NET
Dragging and Dropping with VB.NET
Dragging and Dropping with VB.NET Dragging and Dropping with VB.NET
Dragging and Dropping with VB.NET
Dragging and Dropping with VB.NET
Dragging and Dropping with VB.NET Dragging and Dropping with VB.NET Dragging and Dropping with VB.NET Dragging and Dropping with VB.NET Dragging and Dropping with VB.NET Dragging and Dropping with VB.NET Dragging and Dropping with VB.NET
Dragging and Dropping with VB.NET
Dragging and Dropping with VB.NET
 
Dragging and Dropping with VB.NET
Dragging and Dropping with VB.NET
 
-->