Aggiungi al form il seguente codice:
.codice:Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) Const WM_NCHITTEST As Integer = &H84 Const HTCLIENT As Integer = 1 Const HTTOP As Integer = 12 Const HTTOPLEFT As Integer = 13 Const HTTOPRIGHT As Integer = 14 Const HTLEFT As Integer = 10 Const HTRIGHT As Integer = 11 Const HTBOTTOM As Integer = 15 Const HTBOTTOMLEFT As Integer = 16 Const HTBOTTOMRIGHT As Integer = 17 Const borderWidth As Integer = 5 MyBase.WndProc(m) If m.Msg = WM_NCHITTEST And m.Result.ToInt32 = HTCLIENT Then Dim p As New Drawing.Point(m.LParam.ToInt32 And &HFFFF, m.LParam.ToInt32 >> 16) p = Me.PointToClient(p) If p.X < borderWidth Then If p.Y < borderWidth Then m.Result = New IntPtr(HTTOPLEFT) ElseIf p.Y + borderWidth > Me.Height Then m.Result = New IntPtr(HTBOTTOMLEFT) Else m.Result = New IntPtr(HTLEFT) End If ElseIf p.X + borderWidth > Me.Width Then If p.Y < borderWidth Then m.Result = New IntPtr(HTTOPRIGHT) ElseIf p.Y + borderWidth > Me.Height Then m.Result = New IntPtr(HTBOTTOMRIGHT) Else m.Result = New IntPtr(HTRIGHT) End If ElseIf p.Y < borderWidth Then m.Result = New IntPtr(HTTOP) ElseIf p.Y + borderWidth > Me.Height Then m.Result = New IntPtr(HTBOTTOM) End If End If
In questo modo il form potrà essere ridimensionato normalmente. Se invece ti interessa solamente il codice per il ridimensionamento in basso a destra inserisci
.codice:Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) Const WM_NCHITTEST As Integer = &H84 Const HTCLIENT As Integer = 1 Const HTBOTTOMRIGHT As Integer = 17 Const borderWidth As Integer = 5 MyBase.WndProc(m) If m.Msg = WM_NCHITTEST And m.Result.ToInt32 = HTCLIENT Then Dim p As New Drawing.Point(m.LParam.ToInt32 And &HFFFF, m.LParam.ToInt32 >> 16) p = Me.PointToClient(p) If p.X + borderWidth > Me.Width And p.Y + borderWidth > Me.Height Then m.Result = New IntPtr(HTBOTTOMRIGHT) End If End If End Sub

Rispondi quotando