Controlli - Muove i textBox




Muove le textbox o altri controlli.

Const HTCAPTION = 2
Const WM_NCLBUTTONDOWN = &HA1

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 Long) As Long

Private Sub Command1_Click()
Unload Me
End Sub

Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim ReturnVal As Long
If Button = 1 Then
X = ReleaseCapture()
ReturnVal = SendMessage(Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0)
End If
End Sub


Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim ReturnVal As Long
If Button = 1 Then
X = ReleaseCapture()
ReturnVal = SendMessage(Text1.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0)
End If

End Sub

Private Sub Text2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim ReturnVal As Long
If Button = 1 Then
X = ReleaseCapture()
ReturnVal = SendMessage(Text2.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0)
End If

End Sub











( controllimuoveitextbox.html )- by Paolo Puglisi - Modifica del 17/12/2023