Share via


Decorator Class

When overridden in a derived class, represents a decorator element in the diagram.

Inheritance Hierarchy

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.11.0 (in Microsoft.VisualStudio.Modeling.Sdk.Diagrams.11.0.dll)

Syntax

'Declaration
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
Protected method Decorator(ShapeField, PointD) Initializes a new instance of the Decorator class.
Protected method Decorator(ShapeField, PointD, Boolean) Constructs a new decorator.

Top

Properties

  Name Description
Public property CanMove Whether this decorator can be moved. A decorator can be moved only if it is instantiated as moveable and also requires a host.
Protected property DecoratorAnchorMargins Gets the margin around the field. The decorator can attach itself to the field in this area.
Public property Field Gets the field to which the decorator is assigned.
Public property Offset Gets or sets the offset that modifies the default position of the decorator.
Public property RequiresHost Gets the decorator and verifies whether the position between it and the shape requires a host shape.

Top

Methods

  Name Description
Public method AssociateValueWith(Store, AssociatedPropertyInfo) Associates the decorator with a store property that is assigned to the shape.
Public method AssociateValueWith(Store, Guid) Associates the decorator with a store property that is assigned to the shape.
Public method AssociateValueWith(Store, Guid, AssociatedPropertyInfo) Associates the decorator with a store property that is assigned to the shape.
Public method AssociateVisibilityWith(Store, AssociatedPropertyInfo) Associates the visibility of the decorator with a store property that is assigned to a shape.
Public method AssociateVisibilityWith(Store, Guid) Associates the visibility of the decorator with a store property that is assigned to a shape.
Public method AssociateVisibilityWith(Store, Guid, AssociatedPropertyInfo) Associates the visibility of the decorator with a store property that is assigned to a shape.
Public method ConfigureHostShape Creates a host shape or configures an existing host shape.
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetHostShape Gets the host shape.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method GetValue Gets the association between the decorator and a shape.
Public method GetVisible Gets the visibility of the decorator that is assigned to a shape.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method OnAfterOffsetChanged Enables derived classes to modify the decorator after the offset has changed.
Public method RepositionHostShape Repositions the host shape and sets its visibility.
Public method SetValue Sets the association with the decoration and a shape.
Public method SetVisible Sets the visibility of a decorator that is assigned to a shape.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public method UpdateDecoratorHostShapes(ModelElement) Updates the bounds for the host shapes.
Public method UpdateDecoratorHostShapes(ModelElement, Guid) Updates the bounds for the host shapes.
Public method 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