For a class derived from Panel
, the designer is enabled by default and you don't need to do anything, because the designer of panel is PanelDesigner
which is derived from ScrollableControlDeigner
which is derived from ParentControlDesigner
:
ParentControlDesigner
provides a base class for designers of
controls that can contain child controls. In addition to the methods
and functionality inherited from the ControlDesigner
and
ComponentDesigner
classes, ParentControlDesigner
enables child
controls to be added to, removed from, selected within, and arranged
within the control whose behavior it extends at design time.
You can enable the designer by setting ParentControldesigner
as designer of your control. For example:
using System.ComponentModel;
using System.Windows.Forms;
using System.Windows.Forms.Design;
[Designer(typeof(ParentControlDesigner))]
public class MyControl : Control
{
}