Prev: Will this object get destroyed?
Next: VB6.0 SP4 can't be instlled - 'cannot find the Visual Studio common directory'
From: Bee on 15 Oct 2009 12:27 2nd attempt to post. Borderless Borderless Form ? How to remove the border(black) from the borderless form (form has a menu that I need) ? ============================================================== The following is code to move and resize the borderless form. Hope this is usefull to someone. Did lots of searching and cobbled it together today. Public Const WM_NCLBUTTONDOWN As Long = &HA1 Public Const HTCAPTION As Integer = 2 Public Const HTBOTTOMRIGHT As Integer = 17 Public Declare Function ReleaseCapture Lib "user32" () As Long Public 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 Sub Form_MouseMove(Button As Integer, _ ShiftState As Integer, _ X As Single, _ Y As Single) ResizeMove Button, ShiftState, X, Y End Sub 'Form_MouseMove Private Sub ResizeMove(Button As Integer, _ ShiftState As Integer, _ X As Single, _ Y As Single) Dim bSize As Boolean Const lSizeHotPct as Long = 10 ' percent of lower right corner as a sizing hotspot ' otherwise a move hotspot bSize = False bMove = False Select Case Button Case vbLeftButton Select Case X Case Me.Width - Me.Width / lSizeHotPct To Me.Width Select Case Y Case Me.Height - Me.Height / lSizeHotPct To Me.Height bSize = True Case Else bMove = True End Select Case Else bMove = True End Select If bSize Then Screen.MousePointer = vbSizeNWSE ' start resize ReleaseCapture SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTBOTTOMRIGHT, 0& Else If bMove Then Screen.MousePointer = vbSizeAll ' start move ReleaseCapture SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0& Else Screen.MousePointer = vbDefault End If End If Case Else Screen.MousePointer = vbDefault End Select End Sub 'ResizeMove |