Hello,

I want to move a panel smoothly like a form.

anybody can help me please? thanks ^_^

Recommended Answers

All 3 Replies

See if this helps.

Public Class Form1
    Private allowCoolMove As Boolean = False
    Private myCoolPoint As New Point

    Private Sub Panel1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown
        allowCoolMove = True
        myCoolPoint = New Point(e.X, e.Y)
        Me.Cursor = Cursors.SizeAll
    End Sub

    Private Sub Panel1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove
        If allowCoolMove = True Then
            Panel1.Location = New Point(Panel1.Location.X + e.X - myCoolPoint.X, Panel1.Location.Y + e.Y - myCoolPoint.Y)
        End If
    End Sub

    Private Sub Panel1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseUp
        allowCoolMove = False
        Me.Cursor = Cursors.Default
    End Sub
End Class

Perfect! You're a really nice Thanks to you codeorder

Is it possible to make the pannel aling to grid?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.