Resizing

Private Declare Function ReleaseCapture Lib "user32" () As Long 
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
   (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTBOTTOMRIGHT = 17
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
   (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Sub UserForm_MouseDown( _
   ByVal Button As Integer, _
   ByVal Shift As Integer, _
   ByVal X As Single, _
   ByVal Y As Single)

  Dim lngHwnd As Long
  If X >= Me.Width - 10 Then
    If Y >= Me.Height - 30 Then
      lngHwnd = FindWindow(vbNullString, Me.Caption)
      ReleaseCapture
      SendMessage lngHwnd, WM_NCLBUTTONDOWN, HTBOTTOMRIGHT, ByVal 0&
    End If
  End If
End Sub

Private Sub UserForm_MouseMove( _
   ByVal Button As Integer, _
   ByVal Shift As Integer, _
   ByVal X As Single, _
   ByVal Y As Single)
If X >= Me.Width - 10 Then
  If Y >= Me.Height - 30 Then
    Me.MousePointer = fmMousePointerSizeNWSE
  End If
Else
  Me.MousePointer = fmMousePointerDefault
End If
End Sub


© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited TopPrevNext