[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 742
  • Last Modified:

How to resize and move controls?

How can I resize and move controls during runt-time using handles like there are in the attached picture ?

How can I do that using VB.net or C#?

I know how to move and resize the control without handles. It is not my question. I want to show those handles and, usimg those, the user can move and resize a control as he/she wishes.
2 Solutions
Hello, jr_barros_jr,

You could do this by adding custom controls to the form that represent the grab-handles around the control in question.  

Override the OnMouseDown method of the grab-handle controls to record the current mouse position and (optionally) define a "tolerance" rectangle.  Then override the OnMouseMove method.  If the mouse button is still down and the mouse has moved outside of the tolerance rectangle invoke the DoDragDrop method.  Finally add code to the Form's DragEnter, DragLeave, DragOver, and DragDrop events to animate the desired operation using the move/resize methods that you are already familiar with.

I've left out a lot of detail, but that's the gist of it.  It's a fair bit of work, eh.

Kumaraswamy RCommented:

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now