by Arvind (2 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Sun 10th June 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
moving controls at run time
API Declarations
Dim x1, y1, z1, w1, t1, l1
Private Sub Command1_DragDrop(Source As Control, X As Single, Y As Single)
If X > x1 Then
Command1.move l1 + X - x1, t1 + Y - y1, z1, w1
Else
Command1.move l1 - x1 + X, t1 - y1 + Y, z1, w1
End If
End Sub
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
z1 = Command1.Width
w1 = Command1.Height
t1 = Command1.top
l1 = Command1.Left
x1 = X
y1 = Y
Command1.Drag
End Sub
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
If X > x1 Then
Command1.move X - x1, Y - y1, z1, w1
Else
Command1.move x1 - X, y1 - Y, z1, w1
End If
End Sub