Here is a sample code.
Make a form with 3 buttons - Button1, Button2, Button3
Make the FORM-property AllowDrop=True
Insert this code:
from her ---------------------------------------
Dim GripOffset As Point
Private Sub btnMouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) _
Handles Button1.MouseDown, Button2.MouseDown, Button3.MouseDown
If e.Button = MouseButtons.Left Then
GripOffset.X = e.X
GripOffset.Y = e.Y
sender.DoDragDrop(sender, DragDropEffects.All)
End If
End Sub
Private Sub frmDragEnter(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) _
Handles MyBase.DragEnter
If e.Data.GetDataPresent("System.Windows.Forms.Button") Then
e.Effect = DragDropEffects.Copy
End If
End Sub
Private Sub frmDragDrop(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) _
Handles MyBase.DragDrop
Dim DroppedObj As Button = e.Data.GetData("System.Windows.Forms.Button")
Dim NPos As New Point()
NPos = Me.PointToClient(MousePosition)
NPos.Offset(-GripOffset.X, -GripOffset.Y)
DroppedObj.Location = NPos
End Sub
To here -------------------------------------
hmmm ...(is it all ??) .... now (I think), when you run the program you
should be able to dragNdrop the buttons - OK ?
BUT only 1 button at a time - I want to select two or all tree and dragNdrop
them at one time - but HOW ?
KS, Denmark