How to move a control contained within a usercontrol at design time

  • Thread starter Thread starter p_cranfield
  • Start date Start date
P

p_cranfield

Hi

I am trying to work out how to move controls contained within a user
controls at design time using the mouse in the IDE.

Consider the following:
Project A contains usercontrol1 with several panels.
Project B contains a form with usercontrol1

I would like to be able to click on a panel in the instance of
usercontrol1 on the form in Project B and simply drag it around the
space of the control.
I have set the "Modifiers" property of the panel to "Public" and can
see it when I look at the property pages of the usercontrol1 instance
on the form. I can even set the location of it. Why can I not simply
drag the panel within the control ? Is it possible ?

Phil
 
The best way is to create a cursor from the panel's graphic's object by
saving it to a bitmap then creating a cursor from the bitmap. This is done
in the mousedown/mousemove event then reposition the panel when the mouseup
event occurs. It's bit trickey and you have to use BitBlt API to do it
quickly and then figure out where the mouse is when you trigger the mouse up
event.
 
That does seem like a lot of work. I think I will just hard code the
layout as and when I need it.
Thanks for your prompt reply Dennis.
 
Back
Top