Move a non-caption form using no API, no DLL
VB6 Custom Functions, VB6 Custom Controls/Forms/Menus, VB6 Miscellaneous, VB6 Code Cache
No attachments for this post
Paste the following code in a module and call it from the mousemove routine of the form that you like to move as: mousemove [form.name],x,y,button.
Drag the form to move it, use same calling code if you need to move the form dragging over a control in the form (pay attention to click_routine potential conflict).
Sub moveform(ff As Form, xx, yy, bt)
Static oldx, oldy, mf
Dim moveleft, movetop
moveleft = ff.Left + xx - oldx
movetop = ff.Top + yy - oldy
If bt = vbLeftButton Then
If mf = 0 Then
ff.Move moveleft, movetop
mf = 1
mf = 0
oldx = xx
oldy = yy
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
moveform Me, X, Y, Button
This code originally appeared on AndreaVB.com, and has been republished here with the permission of Andrea Tincani.
Comments on this post
No comments have been added for this post.
You must be logged in to make a comment.