Decorator Class
When overridden in a derived class, represents a decorator element in the diagram.
Inheritance Hierarchy
System.Object
Microsoft.VisualStudio.Modeling.Diagrams.Decorator
Microsoft.VisualStudio.Modeling.Diagrams.ConnectorDecorator
Microsoft.VisualStudio.Modeling.Diagrams.ShapeDecorator
Namespace: Microsoft.VisualStudio.Modeling.Diagrams
Assembly: Microsoft.VisualStudio.Modeling.Sdk.Diagrams.10.0 (in Microsoft.VisualStudio.Modeling.Sdk.Diagrams.10.0.dll)
Syntax
'宣言
Public MustInherit Class Decorator
public abstract class Decorator
public ref class Decorator abstract
[<AbstractClass>]
type Decorator = class end
public abstract class Decorator
The Decorator type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Decorator(ShapeField, PointD) | Initializes a new instance of the Decorator class. | |
Decorator(ShapeField, PointD, Boolean) | Constructs a new decorator. |
Top
Properties
Name | Description | |
---|---|---|
CanMove | Whether this decorator can be moved. A decorator can be moved only if it is instantiated as moveable and also requires a host. | |
DecoratorAnchorMargins | Gets the margin around the field. The decorator can attach itself to the field in this area. | |
Field | Gets the field to which the decorator is assigned. | |
Offset | Gets or sets the offset that modifies the default position of the decorator. | |
RequiresHost | Gets the decorator and verifies whether the position between it and the shape requires a host shape. |
Top
Methods
Name | Description | |
---|---|---|
AssociateValueWith(Store, AssociatedPropertyInfo) | Associates the decorator with a store property that is assigned to the shape. | |
AssociateValueWith(Store, Guid) | Associates the decorator with a store property that is assigned to the shape. | |
AssociateValueWith(Store, Guid, AssociatedPropertyInfo) | Associates the decorator with a store property that is assigned to the shape. | |
AssociateVisibilityWith(Store, AssociatedPropertyInfo) | Associates the visibility of the decorator with a store property that is assigned to a shape. | |
AssociateVisibilityWith(Store, Guid) | Associates the visibility of the decorator with a store property that is assigned to a shape. | |
AssociateVisibilityWith(Store, Guid, AssociatedPropertyInfo) | Associates the visibility of the decorator with a store property that is assigned to a shape. | |
ConfigureHostShape | Creates a host shape or configures an existing host shape. | |
Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetHostShape | Gets the host shape. | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GetValue | Gets the association between the decorator and a shape. | |
GetVisible | Gets the visibility of the decorator that is assigned to a shape. | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
OnAfterOffsetChanged | Enables derived classes to modify the decorator after the offset has changed. | |
RepositionHostShape | Repositions the host shape and sets its visibility. | |
SetValue | Sets the association with the decoration and a shape. | |
SetVisible | Sets the visibility of a decorator that is assigned to a shape. | |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
UpdateDecoratorHostShapes(ModelElement) | Updates the bounds for the host shapes. | |
UpdateDecoratorHostShapes(ModelElement, Guid) | Updates the bounds for the host shapes. | |
UpdateHostShapeVisibility | Updates the visibility of the host shape. |
Top
Remarks
Decorators are wrapped around other elements in the diagram to format them.
To guarantee that inner decorators do not overlap, you should anchor them to the diagram. To anchor decorators, first override [InitializeShapeFields] to call the base. Then use [FindShapeField] to locate the shape field to which you want to apply the decorator, and then call the appropriate anchoring method.
Examples
In the following example, the Name decorator is anchored to the right side of the Name2 decorator.
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);
}
}
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also
Reference
Microsoft.VisualStudio.Modeling.Diagrams Namespace
Change History
Date |
History |
Reason |
---|---|---|
June 2010 |
Extended and clarified descriptions. |
Customer feedback. |