Moving & resizing controls at runtime
-
I'm looking for a way to make it possible for the user to move a control on the form (or let's say inside a panel) during runtime by clicking and dragging with the mouse. Also, I'd like for the user to be able to resize the control by clicking on the edges and dragging. Could someone point me to an article on how to do this perhaps or even explain the key principles in this thread please? I suppose it's almost like creating a runtime form editor but I have no need to add controls at runtime. I just want to be able to resize and move one control that will already be on the form.
-
I'm looking for a way to make it possible for the user to move a control on the form (or let's say inside a panel) during runtime by clicking and dragging with the mouse. Also, I'd like for the user to be able to resize the control by clicking on the edges and dragging. Could someone point me to an article on how to do this perhaps or even explain the key principles in this thread please? I suppose it's almost like creating a runtime form editor but I have no need to add controls at runtime. I just want to be able to resize and move one control that will already be on the form.
I think you'll need to capture mouse down, mouse move and mouse up events on the controls and set their Location or Size properties accordingly. To display handles on them you'll need to override their OnPaint methods.
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) -
I'm looking for a way to make it possible for the user to move a control on the form (or let's say inside a panel) during runtime by clicking and dragging with the mouse. Also, I'd like for the user to be able to resize the control by clicking on the edges and dragging. Could someone point me to an article on how to do this perhaps or even explain the key principles in this thread please? I suppose it's almost like creating a runtime form editor but I have no need to add controls at runtime. I just want to be able to resize and move one control that will already be on the form.
For resize controls, u can change the size of control:
control.height = x
control.weight = y& for move its, u can change the location of its:
control.left = X
control.top = Yu must write these code to event that u want (for example mouse click btn)...
-
For resize controls, u can change the size of control:
control.height = x
control.weight = y& for move its, u can change the location of its:
control.left = X
control.top = Yu must write these code to event that u want (for example mouse click btn)...
-
I'm looking for a way to make it possible for the user to move a control on the form (or let's say inside a panel) during runtime by clicking and dragging with the mouse. Also, I'd like for the user to be able to resize the control by clicking on the edges and dragging. Could someone point me to an article on how to do this perhaps or even explain the key principles in this thread please? I suppose it's almost like creating a runtime form editor but I have no need to add controls at runtime. I just want to be able to resize and move one control that will already be on the form.