Movable component

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How I can create a movable component, for example a button, in run-time?

Thanks
 
Mircea,

In order to do this, you will have to handle when the button can be
moved (most likely when you press the mouse button down), and then change
the Location property of the button as you get input. For example, on the
MouseDown event, you set a variable indicating that you are tracking the
movement of the mouse. Then, in the MouseMove event handler, you set the
Location property of the button depending on where the mouse moves (and if
the flag is set). Finally, in the MouseUp event, set the flag to false.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top