Results 1 to 2 of 2

Thread: drag drop

  1. #1

    Thread Starter
    Hyperactive Member demon.KILER's Avatar
    Join Date
    Jul 2006
    Location
    I cannot remember !?
    Posts
    408

    Question drag drop

    hi all
    I have 4 buttons and a tablelayoutpanel with 5 cells

    I want the buttons to be able to drag and drop in any of the cells
    VS 2005 .....Framework SDK 3.0

    "Its mostly the brave one who choose to not fight"

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: drag drop

    Drag and drop is a very standard mechanism and is performed in essentially the same way no matter the data being dragged. You should search MSDN to get the basics. Once you understand the principles involved then you'll understand what I'm about to say and where it fits in.

    Handle the MouseDown event of the Buttons and pass the Button itself to DoDragDrop as the data. You then handle the DragDrop event of the TLP to get a reference to the Button that you need to drop. You can then calculate the column and row position of the mouse cursor and call the grid's SetCellPosition method to move the Button to that cell.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width