Perfect native borderless form moving using any control
Alright guys,
I've finally found a way to create PERFECT borderless form moving that uses the NATIVE Windows Form moving method. The other method where it just checks if your mouse is down and moves with your mouse is BUGGY. Load up a form then shake your mouse around while moving the it and you will see your mouse has moved it's position on the form.
I was hesitant to release this, but here you go. Don't leech it.
Put this at the top of your code:
Put this inside your class, not inside a sub:
Put this in your control's Click, MouseDown, and MouseMove events:
Credits: Me and Aaron
I've finally found a way to create PERFECT borderless form moving that uses the NATIVE Windows Form moving method. The other method where it just checks if your mouse is down and moves with your mouse is BUGGY. Load up a form then shake your mouse around while moving the it and you will see your mouse has moved it's position on the form.
I was hesitant to release this, but here you go. Don't leech it.
Put this at the top of your code:
Code:
Imports System.Runtime.InteropServices
Put this inside your class, not inside a sub:
Code:
<DllImport("user32.dll")> _
Public Shared Function ReleaseCapture() As Boolean
End Function
<DllImport("user32.dll")> _
Public Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
End Function
Put this in your control's Click, MouseDown, and MouseMove events:
Code:
ReleaseCapture() SendMessage(Handle, &HA1, &H2, 0)
![=]](/forum/images/emotions/=].gif)



