简体   繁体   中英

design panel without parent form in Visual Studio

Anyone come up with a way that I can design a panel without a form?

On the surface usercontrol doesn't seem the way to go.

Background: I come from a text editor world and VS is new to me. We did everything with panels instead of forms. So open for learning. Specifically have a base class panel (ExtendedPanel) that defines some basic controls: Cancel, Save, Save and Close. This ExtendedPanel then will be used for ClientExtendedPanel that is tied to a bindingsouce clientBindingSource. This is all tied to my entity framework model. So I will add, edit and delete sql datarows for my Client table. If no changes have happened by Save button will not be enabled. If I make a change but hit cancel it will warn me. I've done all this before but since I left that company I don't have access to the code base and they didn't use VS (text editor only)so it wasn't really transportable anyway.

All that background so I can ask: Is usercontrol the way to go, or is there something that will allow me to visually add controls to a panel like it is a form?

Yes, a UserControl provides a form-like canvas in the designer for you to add other controls (buttons, etc).

You can do this too by inheriting a panel and writing the code to add the buttons and wire their events, etc, but you won't get the designer support.

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