Decorator 類別
在衍生類別中覆寫時,表示圖表中的 Decorator 項目。
繼承階層架構
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) | 建構新的 Decorator。 |
回頁首
屬性
名稱 | 描述 | |
---|---|---|
![]() |
CanMove | 是否可以移動這個裝飾項。裝飾項目只有在執行個體化為可移動時,而且還必須有主機,才能加以移動。 |
![]() |
DecoratorAnchorMargins | 取得欄位周圍的邊界。裝飾項目可以將本身附加到此區域中的欄位。 |
![]() |
Field | 取得指派 Decorator 至其中的欄位。 |
![]() |
Offset | 取得或設定位移,此位移可修改 Decorator 的預設位置。 |
![]() |
RequiresHost | 取得 Decorator,並確認它與圖案之間的位置是否需要主機圖案。 |
回頁首
方法
回頁首
備註
裝飾項目在圖表上的其他項目指定的格式化方式。
若要確保內部 Decorator 不重疊,您應該錨定至圖表。 錨定 Decorator,第一個覆寫 InitializeShapeFields 呼叫基底。 然後使用 FindShapeField 找出要套用這個 Decorator 的圖案欄位,然後呼叫適當的錨定方法。
範例
在下列範例中,名稱裝飾項目錨定至這個 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);
}
}
執行緒安全
這個類型的任何 Public static (在 Visual Basic 中為 Shared) 成員都是安全執行緒。不保證任何執行個體成員是安全執行緒。