Saturday, November 15, 2008

Panel Movement in .NET

Moving Panels at run time using VB .NET

'Declare p1move as public as
Dim p1move as Integer = 0

Private Sub Panel1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown


If e.Button = "1048576" Then
p1move = 1
Else
p1move = 0
End If


End Sub


Private Sub Panel1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove

If p1move = 1 Then
Me.Location = New System.Drawing.Point(Me.Location.X + (e.X - curX), Me.Location.Y + (e.Y - curY))
Else
curX = e.X
curY = e.Y
End If


End Sub


Private Sub Panel1_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseUp

p1move = 0

End Sub



Click here for coverting VB .NET to C#.NET and viseversa

No comments: