Skip to content

Instantly share code, notes, and snippets.

@alshell7
Last active March 25, 2017 20:39
Show Gist options
  • Save alshell7/e7d7cce401d4d633c8a23d73e4a19a35 to your computer and use it in GitHub Desktop.
Save alshell7/e7d7cce401d4d633c8a23d73e4a19a35 to your computer and use it in GitHub Desktop.
Tweaking Windows Form in VB.Net
'Here Changing the msg value, tweaks out the window state and style. This is awesome !!
Protected Overrides Sub WndProc(ByRef m As Message)
If (m.Msg = 132) Then
m.Result = CType(2, IntPtr)
' Disable this sub for NoMoving Window
Return
End If
MyBase.WndProc(m)
End Sub
'131 = Eliminates the resizing and padding of the window
'132 = Moves the window
'134 = Animates the window as if it is not focused or not active window.
'Some other notable but strange codes
'13 - adds the Title bar even if the form had no any kind of borderstyles
'and,
Protected Overrides Sub WndProc(ByRef m As Message)
If (m.Msg = 134) Then
m.Result = CType(2, IntPtr)
' Disable this sub for NoMoving Window
Return
End If
'MyBase.WndProc(m)
MyBase.DefWndProc(m)
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment