ContainerControlDesigner 类  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
为包含可以在设计时修改的子控件或属性的控件提供设计器功能。
public ref class ContainerControlDesigner : System::Web::UI::Design::ControlDesigner
	public class ContainerControlDesigner : System.Web.UI.Design.ControlDesigner
	type ContainerControlDesigner = class
    inherit ControlDesigner
	Public Class ContainerControlDesigner
Inherits ControlDesigner
		- 继承
 
- 派生
 
示例
下面的代码示例演示如何从 ContainerControlDesigner 类派生设计器类。 该示例定义一个派生自 类的 CompositeControl 简单控件,然后定义派生自 ContainerControlDesigner 类的关联设计器。 派生设计器类重写 FrameCaption 和 FrameStyle 属性,以自定义设计图面上控件的可编辑区域周围的框架。
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.Web.UI;
using System.Web.UI.Design;
using System.Web.UI.Design.WebControls;
using System.Web.UI.WebControls;
namespace ControlDesignerSamples.CS
{
    // Define a simple composite control, derived from the 
    // System.Web.UI.WebControls.CompositeControl class.
    [
        Designer(typeof(SimpleContainerControlDesigner)) , 
        ParseChildren(false)
    ]
    public class SimpleContainerControl : CompositeControl
    {
    }
    // Define the designer for the simple composite control.
    // The designer derives from System.Web.UI.Design.ContainerControlDesigner.
    // The designer defines the style and caption for frame around the 
    // editable region in the design surface.
    public class SimpleContainerControlDesigner : ContainerControlDesigner
    {
        private Style _style = null;
        // Define the caption text for the frame in the design surface.
        public override string FrameCaption
        {
            get
            {
                return "= My simple container control =";
            }
        }
        // Define the style of the frame around the control in the design surface.
        public override Style FrameStyle
        {
            get
            {
                if (_style == null)
                {
                    _style = new Style();
                    _style.Font.Name = "Verdana";
                    _style.Font.Size = new FontUnit("XSmall");
                    _style.BackColor = Color.LavenderBlush;
                    _style.ForeColor = Color.DarkBlue;
                }
                return _style;
            }
        }
    }
}
Imports System.ComponentModel
Imports System.ComponentModel.Design
Imports System.Collections
Imports System.Drawing
Imports System.Web.UI
Imports System.Web.UI.Design
Imports System.Web.UI.Design.WebControls
Imports System.Web.UI.WebControls
Namespace ControlDesignerSamples.VB
    ' Define a simple composite control, derived from the 
    ' System.Web.UI.WebControls.CompositeControl class.
    <Designer(GetType(SimpleContainerControlDesigner)), _
     ParseChildren(False)> _
    Public Class SimpleContainerControl
        Inherits CompositeControl
    End Class
    ' Define the designer for the simple composite control.
    ' The designer derives from System.Web.UI.Design.ContainerControlDesigner.
    ' The designer defines the style and caption for the frame around the 
    ' editable region of the control in the design surface.
    Public Class SimpleContainerControlDesigner
        Inherits ContainerControlDesigner
        Private _style As Style = Nothing
        ' Define the caption text for the frame in the design surface.
        Public Overrides ReadOnly Property FrameCaption() As String
            Get
                Return "- My simple container control -"
            End Get
        End Property
        ' Define the style of the frame around the control in the design surface.
        Public Overrides ReadOnly Property FrameStyle() As Style
            Get
                If _style Is Nothing Then
                    _style = New Style()
                    _style.Font.Name = "Verdana"
                    _style.Font.Size = New FontUnit("XSmall")
                    _style.BackColor = Color.LavenderBlush
                    _style.ForeColor = Color.DarkBlue
                End If
                Return _style
            End Get
        End Property
    End Class
End Namespace
	注解
类 ContainerControlDesigner 为可在设计图面上修改的控件提供基设计器类。 这包括包含子控件或可编辑的内部属性的控件。 ContainerControlDesigner提供单个帧区域来表示控件,并在设计时自动处理控件的呈现。
在 ParseChildrenAttribute 关联的 控件上应用 属性,以确定 的设计时行为 ContainerControlDesigner。 将 ParseChildrenAttribute 设置应用于关联的控件,如下所示:
falseContainerControlDesigner表示作为子控件的可编辑设计区域的内容。trueContainerControlDesigner表示可编辑设计区域的内容作为控件的可编辑内部属性。
控件开发人员可以根据正在开发的控件类型,从多个基础设计器之一派生和扩展自定义设计器,如以下列表中定义:
允许在设计时向其中添加子控件的控件可以从 类派生 ContainerControlDesigner 。 例如, PanelContainerDesigner 类派生自 ContainerControlDesigner 类,表示设计图面上的控件 Panel 。
具有一个或多个子控件的控件,并且可能还具有可在设计时添加控件的可编辑设计器区域,可以从 类派生 CompositeControlDesigner 。
需要自定义设计时处理的控件可以从 基 ControlDesigner 类派生。
注意
类 ContainerControlDesigner 替换已过时 ReadWriteControlDesigner 的类。
DesignerAttribute使用 特性将自定义设计器类与自定义控件实现相关联。 有关如何将控件设计器与自定义控件配合使用的详细信息,请参阅 演练:为 Web 服务器控件创建基本控件设计器。
构造函数
| ContainerControlDesigner() | 
		 初始化 ContainerControlDesigner 类的新实例。  | 
        	
属性
| ActionLists | 
		 获取控件设计器的操作列表集合。 (继承自 ControlDesigner) | 
        	
| AllowResize | 
		 获取一个值,该值指示控件的大小在设计时是否可以调整。  | 
        	
| AssociatedComponents | 
		 获取与设计器所管理的组件关联的组件集合。 (继承自 ComponentDesigner) | 
        	
| AutoFormats | 
		 获取预定义自动格式设置方案的集合,这些方案将在设计时显示于关联控件的“自动套用格式”对话框中。 (继承自 ControlDesigner) | 
        	
| Behavior | 
			 
		已过时.
	 
获取或设置与设计器关联的 DHTML 行为。 (继承自 HtmlControlDesigner) | 
        	
| Component | 
		 获取此设计器正在设计的组件。 (继承自 ComponentDesigner) | 
        	
| DataBindings | 
		 获取当前控件的数据绑定集合。 (继承自 HtmlControlDesigner) | 
        	
| DataBindingsEnabled | 
		 获取一个值,该值指示包含关联控件的区域是否支持数据绑定。 (继承自 ControlDesigner) | 
        	
| DesignerState | 
		 获取用于在设计时保持关联控件数据的对象。 (继承自 ControlDesigner) | 
        	
| DesignTimeElement | 
			 
		已过时.
	 
获取一个设计时对象,该对象表示与设计图面上的 HtmlControlDesigner 对象关联的控件。 (继承自 HtmlControlDesigner) | 
        	
| DesignTimeElementView | 
			 
		已过时.
	 
获取控件设计器的视图控件对象。 (继承自 ControlDesigner) | 
        	
| DesignTimeHtmlRequiresLoadComplete | 
			 
		已过时.
	 
获取一个值,该值指示是否必须在设计宿主完成加载之后才能调用 GetDesignTimeHtml 方法。 (继承自 ControlDesigner) | 
        	
| Expressions | 
		 获取当前控件在设计时的表达式绑定。 (继承自 HtmlControlDesigner) | 
        	
| FrameCaption | 
		 获取控件在设计时显示的标题。  | 
        	
| FrameStyle | 
		 获取设计时应用于控件框架的样式。  | 
        	
| HidePropertiesInTemplateMode | 
		 获取一个值,该值指示当控件处于模板模式时,关联控件的属性是否被隐藏。 (继承自 ControlDesigner) | 
        	
| ID | 
		 获取或设置控件的 ID 字符串。 (继承自 ControlDesigner) | 
        	
| InheritanceAttribute | 
		 获取一个特性,该特性指示关联组件的继承类型。 (继承自 ComponentDesigner) | 
        	
| Inherited | 
		 获取一个值,该值指示是否继承此组件。 (继承自 ComponentDesigner) | 
        	
| InTemplateMode | 
		 获取一个值,该值指示控件在设计宿主中是否处于模板查看模式或模板编辑模式之一。 InTemplateMode 属性为只读。 (继承自 ControlDesigner) | 
        	
| IsDirty | 
			 
		已过时.
	 
获取或设置一个值,该值指示 Web 服务器控件是否已被标记为已更改。 (继承自 ControlDesigner) | 
        	
| NoWrap | 
		 获取指定是否在窗口中使用的 HTML   | 
        	
| ParentComponent | 
		 获取此设计器的父组件。 (继承自 ComponentDesigner) | 
        	
| ReadOnly | 
			 
		已过时.
	 
获取或设置一个值,该值指示控件的属性在设计时是否为只读。 (继承自 ControlDesigner) | 
        	
| RootDesigner | 
		 获取包含关联控件的 Web 窗体页的控件设计器。 (继承自 ControlDesigner) | 
        	
| SetTextualDefaultProperty | 
		 为包含可以在设计时修改的子控件或属性的控件提供设计器功能。 (继承自 ComponentDesigner) | 
        	
| ShadowProperties | 
		 获取重写用户设置的属性值的集合。 (继承自 ComponentDesigner) | 
        	
| ShouldCodeSerialize | 
			 
		已过时.
	 
获取或设置一个值,该值指示在序列化期间是否应为当前设计文档在代码隐藏文件中创建控件的字段声明。 (继承自 HtmlControlDesigner) | 
        	
| Tag | 
		 获取表示关联控件的 HTML 标记元素的对象。 (继承自 ControlDesigner) | 
        	
| TemplateGroups | 
		 获取一个模板组集合,其中每个模板组包含一个或多个模板定义。 (继承自 ControlDesigner) | 
        	
| UsePreviewControl | 
		 获取一个值,该值指示控件设计器是否使用临时预览控件来生成设计时 HTML 标记。 (继承自 ControlDesigner) | 
        	
| Verbs | 
		 获取与设计器相关联的组件所支持的设计时谓词。 (继承自 ComponentDesigner) | 
        	
| ViewControl | 
		 获取或设置可用于预览设计时 HTML 标记的 Web 服务器控件。 (继承自 ControlDesigner) | 
        	
| ViewControlCreated | 
		 获取或设置一个值,该值指示是否已创建   | 
        	
| Visible | 
		 获取指示该控件在设计时是否可见的值。 (继承自 ControlDesigner) | 
        	
方法
显式接口实现
| IDesignerFilter.PostFilterAttributes(IDictionary) | 
		 有关此成员的说明,请参见 PostFilterAttributes(IDictionary) 方法。 (继承自 ComponentDesigner) | 
        	
| IDesignerFilter.PostFilterEvents(IDictionary) | 
		 有关此成员的说明,请参见 PostFilterEvents(IDictionary) 方法。 (继承自 ComponentDesigner) | 
        	
| IDesignerFilter.PostFilterProperties(IDictionary) | 
		 有关此成员的说明,请参见 PostFilterProperties(IDictionary) 方法。 (继承自 ComponentDesigner) | 
        	
| IDesignerFilter.PreFilterAttributes(IDictionary) | 
		 有关此成员的说明,请参见 PreFilterAttributes(IDictionary) 方法。 (继承自 ComponentDesigner) | 
        	
| IDesignerFilter.PreFilterEvents(IDictionary) | 
		 有关此成员的说明,请参见 PreFilterEvents(IDictionary) 方法。 (继承自 ComponentDesigner) | 
        	
| IDesignerFilter.PreFilterProperties(IDictionary) | 
		 有关此成员的说明,请参见 PreFilterProperties(IDictionary) 方法。 (继承自 ComponentDesigner) | 
        	
| ITreeDesigner.Children | 
		 有关此成员的说明,请参见 Children 属性。 (继承自 ComponentDesigner) | 
        	
| ITreeDesigner.Parent | 
		 有关此成员的说明,请参见 Parent 属性。 (继承自 ComponentDesigner) |