Private Const cGrip As Integer = 16 ' Grip size
Private Const cCaption As Integer = 32
' Caption bar height;
Protected Overrides Sub WndProc(ByRef m As Message)
If m.Msg = &H84 Then
' Trap WM_NCHITTEST
Dim pos As New Point(m.LParam.ToInt32() And &HFFFF, m.LParam.ToInt32() >> 16)
pos = Me.PointToClient(pos)
If pos.X >= Me.ClientSize.Width - cGrip AndAlso pos.Y >= Me.ClientSize.Height - cGrip Then
m.Result = IntPtr.op_Explicit(17)
' HTBOTTOMRIGHT
Return
End If
'**********
If pos.X = 0 AndAlso pos.Y >= Me.ClientSize.Height - cGrip Then
m.Result = IntPtr.op_Explicit(16)
' HTBOTTOMRIGHT
Return
End If
'***************
If pos.X >= Me.ClientSize.Width - cGrip AndAlso pos.Y <= 16 Then
m.Result = IntPtr.op_Explicit(14)
' HTBOTTOMRIGHT
Return
End If
If pos.X < 16 AndAlso pos.Y <= 16 Then
m.Result = IntPtr.op_Explicit(13)
' HTBOTTOMRIGHT
Return
End If
If pos.Y < cCaption Then
m.Result = IntPtr.op_Explicit(2)
' HTCAPTION
Return
End If
End If
MyBase.WndProc(m)