Hi this is a piece of code to move a control at design time by dragging and
dropping.
<<<<<<<code>>>>>>>>
Private dragging As Boolean
Private beginX, beginY As Integer
Private Sub Label1_MouseDown(ByVal sender As Object, ByVal e As _
System.Windows.Forms.MouseEventArgs) Handles Label1.MouseDown
dragging = true
beginX = e.X
beginY = e.Y
End Sub
Private Sub Label1_MouseMove(ByVal sender As Object, ByVal e As _
System.Windows.Forms.MouseEventArgs) Handles Label1.MouseMove
If dragging = True Then
Label1.Location = New Point(Label1.Location.X + e.X - beginX,
Label1.Location.Y + e.Y - beginY)
Me.Refresh()
End If
End Sub
Private Sub Label1_MouseUp(ByVal sender As Object, ByVal e As _
System.Windows.Forms.MouseEventArgs) Handles Label1.MouseUp
dragging = False
End Sub
<<<<<<<<code>>>>>>>>
hth Peter
"Frank" <(E-Mail Removed)> wrote in message
news:cl8l2f$a9v$(E-Mail Removed)...
> Hello,
>
> drag and drop works fine, but it differs from VB6. In VB6 when I drag a
> control the control follows the mouse.
> Am I correct in the assumption that in VB.NET I myself have to change the
> controls top/left attributes (in the mousemove event) to let it follow the
> mouse?
> Thanks
> Frank
>
>
|