VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Move Controls Smoothly w/ Mouse (Runtime)

Treehill  (1 Submission)   Custom Controls/Forms/Menus   Intermediate   Wed 3rd February 2021

This code demostrates how to move controls smoothly on a form without them redrawing slowly or chunky looking.

Inputs
Just click and drag the picturebox to move it anywhere on the form.

Assumes
I recycled this code that was moving a form, which when calling the SendMessage function, it would mimic the form's menu being clicked and moved, but I changed the handle (hWnd) to the pictureboxes, and it worked.

Returns
n/a

Side Effects
As of yet, I am unaware if I am using the correct flag (HTCAPTION) as a SendMessage param. Obviously it works, but I wasn't sure if there was a different flag that was more appropriate. Reason being, that there is no caption in a picturebox. Be aware of this and any side effects this might case in your code.

API Declarations
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function ReleaseCapture Lib "user32" () As Long

Rate Move Controls Smoothly w/ Mouse (Runtime) (3(3 Vote))
Move Controls Smoothly w/ Mouse (Runtime).bas

Move Controls Smoothly w/ Mouse (Runtime) Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters