简体   繁体   中英

C# - Custom control with panel on it, how do I make the IDE add items to the panel?

I have a custom control which contains a panel, of which I want to be able to drop controls on in the VS IDE and have those controls actually be a child of the panel (which is a child of my custom control) and not have them added to the form my custom control is on.

Basically what happens when you drop controls on a panel not contained in a custom control.

I've tried to google it, but can't seem to come up with any good results, any help would be appreciated :)

Assuming that you're talking about WinForms I think you'll get what you want if you change your custom control to inherit from ContainerControl rather than UserControl .

If it's WebForms it might be worth looking at ContainerControlDesigner , but I don't know much about that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM