I've been trying to move a form that doesn't have a titlebar. I'm using a panel where the titlebar should be. This is as closest I've come to doing this. Once you look at my code you might laugh :)
Right now you can't move it with the canvas, but you can move it with a mousemove event. When I move it with the form, it drops down and to the right. Can someone PLEASE tell me where I'm going wrong. I'm guessing it's because there's no value to the a and b variabes in the MouseMove sub.
Private Sub forml_MouseDown(sender As Object, e As MouseEventArgs) Handles Panel.MouseDown
Dim newPoint As New System.Drawing.Point()
Dim a As Integer
Dim b As Integer
a = Panel.MousePosition.X - Me.Location.X
b = Panel.MousePosition.Y - Me.Location.Y
End Sub
Private Sub form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
Dim newPoint As New System.Drawing.Point()
Dim a As Integer
Dim b As Integer
If e.Button = MouseButtons.Left Then
newPoint = Panel.MousePosition
newPoint.X = newPoint.X - (a)
newPoint.Y = newPoint.Y - (b)
Me.Location = newPoint
End If
End Sub
I would REALLY appreciate some help.