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) |
| 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) |