Results 1 to 1 of 1

Thread: Drag Button in Form

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    200

    Drag Button in Form

    Hi, I have done quite a bit of searching in this forum about the topic of Drag Drop feature that VB.Net offers. I have found a few good examples but they seem to be not what I am looking for in my project. Although the concept is similar, the actual application of the Drag Drop is different. I have several buttons in the Parent Form that I want to drag and drop into a RichTextBox.

    I have the following code, for the button located in the parent form but I am very confused on how I can drag this button to the RichTextForm. I have also set the AllowDrop to True in the properties of the button, which should allow the button to be dragged from one location to the next.

    I am trying to mimic the Solitare game by moving around the buttons, from one location to the next. Although I do not think it uses the RichTextBox to store the cards. If anyone can help me out that would be great. Thanks


    Private Sub Button01_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button01.MouseMove
    If e.Button Then Exit Sub 'Exit if no button is pressed
    If e.X >= 0 And e.Y >= 0 Then Exit Sub 'The Mouse is being dragged outside the control's client area so we can start the drag and drop operation

    End Sub
    Last edited by Srig007; Dec 5th, 2005 at 02:23 PM. Reason: entering code

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