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 DeclarationsDeclare 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