Hi everyone,

I have a borderless window and picturebox GUI, I'm trying to drag the window from it's handles. My code outputs no errors, but it doesn't work either... Any ideas?

Form = frmMain
Picturebox = Image1

Code:
Private Sub Image1_Click()
Public Class frmMain

Private mouseOffset As Point

Private isMouseDown As Boolean = False

Private Sub Image1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Image1.MouseDown

Dim xOffset As Integer

Dim yOffset As Integer

If e.Button = Windows.Forms.MouseButtons.Left Then

xOffset = -e.x - SystemInformation.FrameBorderSize.Width

yOffset = -e.y - SystemInformation.FrameBorderSize.Height

mouseOffset = New Point(xOffset, yOffset)

isMouseDown = True

End If

End Sub

Private Sub Image1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Image1.MouseMove

If isMouseDown Then

Dim mousePos As Point = Control.MousePosition

mousePos.Offset(mouseOffset.X, mouseOffset.Y)

Location = mousePos

End If

End Sub

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

isMouseDown = False

End Sub

End Class
End Sub