Ok, I havent been able to get any of these functions to work. I put them in the said-to-put spots but nothing. How do you move a form w/o having a title bar?
Printable View
Ok, I havent been able to get any of these functions to work. I put them in the said-to-put spots but nothing. How do you move a form w/o having a title bar?
Code:Private Declare Function SystemParametersInfo Lib "User32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long
Private vX!, vY!
Function SetWindowsDragStyle(ByVal FullDrag As Boolean) As Long
Call SystemParametersInfo(37, CLng(FullDrag), 0&, 0)
SetWindowsDragStyle = Err.LastDllError
End Function
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
vX = X: vY = Y
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then Move ScaleX(X - vX, ScaleMode, vbTwips) + left, ScaleY(Y - vY, ScaleMode, vbTwips) + tOp
End Sub
This is the code I use:
Code:'Put in form declarations:
Dim oldX As Long, oldY As Long, isMoving As Boolean
'The following can be used in a picture, form, label, etc.
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
oldX = X
oldY = Y
isMoving = True
End Sub
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If isMoving Then
Me.Top = Me.Top - (oldY - Y)
Me.Left = Me.Left - (oldX - X)
End If
End Sub
Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
isMoving = False
End Sub
This code will move a form easy and without the outline.