PC Review


Reply
 
 
Frank
Guest
Posts: n/a
 
      21st Oct 2004
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


 
Reply With Quote
 
 
 
 
Peter Proost
Guest
Posts: n/a
 
      22nd Oct 2004
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
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DragDrop again zdrakec Microsoft VB .NET 0 9th May 2006 02:58 PM
DragDrop Meelis Microsoft C# .NET 3 13th Dec 2005 04:50 PM
Dragdrop with NTD Laurent Chevallier Microsoft Dot NET Framework Forms 3 16th Aug 2004 05:22 PM
DragDrop Lou Microsoft C# .NET 3 27th Feb 2004 05:44 PM
passing on Control DragDrop to parent DragDrop Microsoft C# .NET 0 12th Dec 2003 08:24 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:05 PM.