user moving/resizing controls at runtime (1 Viewer)

CJ_London

Super Moderator
Staff member
Local time
Today, 23:52
Joined
Feb 19, 2013
Messages
14,358
Attached is a simple form that enables a user to move or resize a control at runtime utilising the mouse events. There are two controls in this example, a textbox and an image control. The code will work with any control that has mousemove events.

For the purposes of this example I have applied to code directly to the textbox mouse events. The image events calls the equivalent code in a module so you only need to code once and it can be applied to any control that has mousemove events. There are other ways of managing the module code and it could easily be converted to a class from which the events can be assigned to the controls if that was a requirement.
 

Attachments

  • dbMoveResizeCtrl.zip
    1.5 MB · Views: 165

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 06:52
Joined
May 7, 2009
Messages
16,393
i stand with my previous comment, Revised the code so that it will Snap to the Left (or Right) Edge
when drag swiftly.
 

pekajo

Registered User.
Local time
Tomorrow, 08:52
Joined
Jul 25, 2011
Messages
124
This is a great idea however I am not able to see how I can duplicate other object like the original video.
Tried copying the original text box and the code but it only moved the first box.
Any ideas?
Peter
 

CJ_London

Super Moderator
Staff member
Local time
Today, 23:52
Joined
Feb 19, 2013
Messages
14,358
If you mean what I think you mean - the second box (the image) uses code from a module
 

Users who are viewing this thread

Top Bottom