Add mouse-button hold down event at run time

TheWizardofInt

Junior Contributor
Joined
Dec 31, 1969
Messages
333
Location
Orlando, FL
I am writing a program which allows adding new components - text boxes and labels

I want to be able to click the edge of a text box, hold the mouse button down and drag it to increase the component's width

How do I add this event to the object that I add at run time?
 
You record the mouse position on mouse down. You compare changes in the coordinates on mouse move and size the control accordingly. Alternatively, you record the postion on mouse down, draw a sizing rectangle on mouse move, and size the control accordingly on mouse up. Not particularly tricky. The coding part is up to you, though. If you run into any problems coding, we'll be glad to help.
 
Back
Top