1

For some reasons, I want to define Panel (Windows Form) using Visual Studio Designer support.

When I define a Form or a UserControl, I get a rectangle in which I can put some controls manually to design my Form or my UserControl.

Example of Panel (currently it is a UserControl) that I want to create

enter image description here

But I don't find any solution to define a control derivated from Panel !

I tried to use Component but it is impossible to drag and drop controls from Toolbox.

I tried UserControl followed by replacement of UserControl name by Panel but after this replacement, manual design stop working all all controls previously added in UserControl are now display as a list of controls.

Exemple of what I gat when renaming 'UserControl' to 'Panel'

enter image description here

How can I do ?

Is it possible ? Using special attributes ?

There exists a similar question for Visual Studio 2010 posted in 2012 !

design panel without parent form in Visual Studio

schlebe
  • 3,387
  • 5
  • 37
  • 50
  • 1
    [Walkthrough: Create a control that takes advantage of design-time features](https://learn.microsoft.com/en-us/dotnet/desktop/winforms/controls/creating-a-wf-control-design-time-features?view=netframeworkdesktop-4.8) – Jimi Apr 05 '21 at 17:56
  • 1
    See also; [IToolboxUser Interface](https://learn.microsoft.com/en-us/dotnet/api/system.drawing.design.itoolboxuser) – Jimi Apr 05 '21 at 18:25
  • 1
    There is [*some* support](https://stackoverflow.com/a/2863807/17034) for enabling design mode for a user control, but that's not practical here. No, once you created a component, you have to use it as-is. – Hans Passant Apr 05 '21 at 18:40
  • ok, in resume, it is impossible using Visual Studio 2019 ! Thanks for your help – schlebe Apr 05 '21 at 20:19
  • Now, when I will add this control to a specific Panel named XPanel, I first add XPanel in a Container and then I can add my UserControl in XPanel. It is a little more complicated but that is the only solution that I have found. – schlebe Apr 05 '21 at 20:21

0 Answers0