0

I have a vb winforms user control which has on it a panel (docked-full). I want a coder who drops my user control onto a form to then be able to drag other control onto the panel of that user control. I've seen several custom designer examples, but none seem to work for me.

Image shows user control and concept

enter image description here

J. Scott Elblein
  • 4,013
  • 15
  • 58
  • 94
Yonkers
  • 17
  • 1
  • 2
    Are you looking for [UserControl with header and content - Allow dropping controls in content panel and Prevent dropping controls in header at design time](https://stackoverflow.com/a/50772584/3110834)? – Reza Aghaei Jan 30 '20 at 17:12
  • 2
    Or this one: [User control containing child control, design mode edit child control](https://stackoverflow.com/a/39925620/3110834) – Reza Aghaei Jan 30 '20 at 17:13

1 Answers1

-1

You just need to make the modifiers property of Panel in your UserControl set public

Amirali Eshghi
  • 963
  • 1
  • 14
  • 21
  • Have you tried it yourself? – Reza Aghaei Jan 30 '20 at 17:10
  • Yes Baradar :)) – Amirali Eshghi Jan 30 '20 at 17:31
  • 1
    Already tried that ... does not work. It appears like it does..but if u move the UC you will see that the added control is on the form behind NOT part of the UC controls – Yonkers Jan 30 '20 at 17:37
  • 3
    That's because when you drop an instance of the UserControl on the form, it will not act as a parent control designer. It's not a drop target. If you want the `UserControl` itself be a drop target at design-time, just decorate it with `[Designer(typeof(ParentControlDesigner))]`. If you want part of it (the inner panel) be a drop target, you need to enable the design mode for the child control. To do so, take a look at the linked posts which I shared under the question. Specially the first one. – Reza Aghaei Jan 30 '20 at 17:41
  • 1
    @Anaramer Maybe you have mistaken it with something else, because it's not the solution. – Reza Aghaei Jan 30 '20 at 17:44
  • Will try and get back to you Reza - Thanks! – Yonkers Jan 30 '20 at 17:49
  • Reza, Appears to be working, but once I drag a control on the the UC I can no longer move, resize or delete the UC from the form. – Yonkers Jan 30 '20 at 18:25
  • 1
    Download the code example and play with it. – Reza Aghaei Jan 30 '20 at 18:34
  • @reza-aghaei You were right. I made a technical mistake – Amirali Eshghi Jan 30 '20 at 20:59