当在派生类中重写时,将表示图中的修饰器元素。
继承层次结构
System.Object
Microsoft.VisualStudio.Modeling.Diagrams.Decorator
Microsoft.VisualStudio.Modeling.Diagrams.ConnectorDecorator
Microsoft.VisualStudio.Modeling.Diagrams.ShapeDecorator
命名空间: Microsoft.VisualStudio.Modeling.Diagrams
程序集: Microsoft.VisualStudio.Modeling.Sdk.Diagrams.12.0(在 Microsoft.VisualStudio.Modeling.Sdk.Diagrams.12.0.dll 中)
语法
声明
Public MustInherit Class Decorator
public abstract class Decorator
Decorator 类型公开以下成员。
构造函数
名称 | 说明 | |
---|---|---|
![]() |
Decorator(ShapeField, PointD) | 初始化 Decorator 类的新实例。 |
![]() |
Decorator(ShapeField, PointD, Boolean) | 构造新的修饰器。 |
页首
属性
名称 | 说明 | |
---|---|---|
![]() |
CanMove | 此修饰器是否可移动。只有在其实例化为可移动的,且需要宿主时,才可以移动修饰器。 |
![]() |
DecoratorAnchorMargins | 获取字段周围的边距。修饰器可将其本身附加到此区域内的字段。 |
![]() |
Field | 获取修饰符被分配到的字段。 |
![]() |
Offset | 获取或设置用于修改修饰器的默认位置的偏移量。 |
![]() |
RequiresHost | 获取一个修饰器,并验证其间的位置及形状是否需要一个主机形状。 |
页首
方法
页首
备注
修饰器在关系图的其他元素环绕设置它们。
为防止内部修饰器重叠,应锚定到关系图。 锚定修饰器,第一个重写 InitializeShapeFields 调用基础。 然后使用 FindShapeField 找到要应用程序的修饰器的形状字段,然后调用适当的锚定的方法。
示例
在下面的示例中,名称修饰器锚定到一个 Name2 修饰器的右侧。
partial class WizardPageShape
{
protected override void InitializeShapeFields(IList<Microsoft.VisualStudio.Modeling.Diagrams.ShapeField> shapeFields)
{
base.InitializeShapeFields(shapeFields);
ShapeField name = ShapeElement.FindShapeField(shapeFields, "Name");
ShapeField name2 = ShapeElement.FindShapeField(shapeFields, "Name2");
name.AnchoringBehavior.SetLeftAnchor(name2, AnchoringBehavior.Edge.Right, 0.01);
}
}
线程安全
此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。