PanelContainerDesigner Class
Assembly: System.Design (in system.design.dll)
The Panel control is used as a container for other controls, especially when controls are generated programmatically.
In a visual designer, when you switch from Source to Design view, the markup source code that describes the associated Panel control is parsed, and a design-time version of the control is created on the design surface. When you switch back to Source view, the design-time control is persisted to markup source code and edited into the markup for the Web page. The PanelContainerDesigner class provides design-time support for Panel controls in a visual designer.
The FrameCaption property gets the caption that appears on the associated Panel control. The FrameStyle property gets the styles of the associated control.
The UsePreviewControl property always returns true, indicating that the designer creates a temporary copy of the associated Panel to generate the design-time markup.
The Initialize method prepares the designer to view, edit, and design the associated Panel control. The AddDesignTimeCssAttributes method sets collection elements to the string representations of various style attributes of the associated control.
The following code example shows how to extend the PanelContainerDesigner class to change the appearance and behavior of controls that are derived from the Panel control at design time.
The example derives the MyPanelContainer class from the Panel control. The example also derives the MyPanelContainerDesigner class from the PanelContainerDesigner class and applies a DesignerAttribute attribute for the MyPanelContainerDesigner on the MyPanelContainer class.
The MyPanelContainerDesigner overrides the following PanelContainerDesigner members:
-
The FrameStyle property to define a design-time border style for the MyPanelContainer control.
-
The FrameCaption property to provide a default caption for the MyPanelContainer control, if none was defined.
-
The Initialize method to throw an ArgumentException exception, if the associated control is not a MyPanelContainer object.
System.ComponentModel.Design.ComponentDesigner
System.Web.UI.Design.HtmlControlDesigner
System.Web.UI.Design.ControlDesigner
System.Web.UI.Design.ContainerControlDesigner
System.Web.UI.Design.WebControls.PanelContainerDesigner