DesignerGlyph 類別

定義

警告

The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*

在活動設計工具最上層的疊置順序位置繪製圖樣 (Glyph)。

public ref class DesignerGlyph abstract
public abstract class DesignerGlyph
[System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public abstract class DesignerGlyph
type DesignerGlyph = class
[<System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")>]
type DesignerGlyph = class
Public MustInherit Class DesignerGlyph
繼承
DesignerGlyph
衍生
屬性

範例

下列程式碼範例示範從 DesignerGlyph 類別衍生的圖像類別。 程式碼會覆寫 GetBoundsOnPaint 方法。

這個程式碼範例是 DesignerGlyphProvider.cs 檔案中<工作流程監視器 SDK>範例的一部分。 如需詳細資訊,請參閱 工作流程監視器

//Define a glyph to show an activity is executing, i.e. not 'closed'
internal sealed class ExecutingGlyph : DesignerGlyph
{
    internal ExecutingGlyph()
    {
    }

    public override Rectangle GetBounds(ActivityDesigner designer, bool activated)
    {
        Rectangle imageBounds = Rectangle.Empty;
        Image image = Resources.Executing;
        if (image != null)
        {
            Size glyphSize = WorkflowTheme.CurrentTheme.AmbientTheme.GlyphSize;
            imageBounds.Location = new Point(designer.Bounds.Right - glyphSize.Width / 2, designer.Bounds.Top - glyphSize.Height / 2);
            imageBounds.Size = glyphSize;
        }
        return imageBounds;
    }

    protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer)
    {
        Bitmap bitmap = Resources.Executing;
        bitmap.MakeTransparent(Color.FromArgb(0, 255, 255));
        if (bitmap != null)
            graphics.DrawImage(bitmap, GetBounds(designer, activated), new Rectangle(Point.Empty, bitmap.Size), GraphicsUnit.Pixel);
    }
}
'Define a glyph to show an activity is executing, i.e. not 'closed'
Friend Class ExecutingGlyph
    Inherits DesignerGlyph
    Public Overrides Function GetBounds(ByVal designer As System.Workflow.ComponentModel.Design.ActivityDesigner, ByVal activated As Boolean) As System.Drawing.Rectangle
        Dim imageBounds As Rectangle = Rectangle.Empty
        Dim image As Image = AppResources.Executing
        If Not image Is Nothing Then
            Dim glyphSize As Size = WorkflowTheme.CurrentTheme.AmbientTheme.GlyphSize
            imageBounds.Location = New Point(designer.Bounds.Right - glyphSize.Width / 2, designer.Bounds.Top - glyphSize.Height / 2)
            imageBounds.Size = glyphSize
        End If
        Return imageBounds
    End Function

    Protected Overrides Sub OnPaint(ByVal graphics As System.Drawing.Graphics, ByVal activated As Boolean, ByVal ambientTheme As System.Workflow.ComponentModel.Design.AmbientTheme, ByVal designer As System.Workflow.ComponentModel.Design.ActivityDesigner)
        Dim bitmap As Bitmap = AppResources.Executing
        bitmap.MakeTransparent(Color.FromArgb(0, 255, 255))

        If Not bitmap Is Nothing Then
            graphics.DrawImage(bitmap, GetBounds(designer, activated), New Rectangle(Point.Empty, bitmap.Size), GraphicsUnit.Pixel)
        End If
    End Sub
End Class

備註

注意

此資料討論已被汰換的類型及命名空間。 如需詳細資訊,請參閱 Windows Workflow Foundation 4.5 中即將淘汰的類型

DesignerGlyph 類別為工作流程設計介面上使用之所有設計工具圖像的基底類別 (Base Class)。

活動設計工具開發人員可以使用繼承自 DesignerGlyph 的類別在 ActivityDesigner 介面上繪製自訂圖像。 DesignerGlyph 類別可在最上層的疊置順序繪製此類圖像,這會將自訂圖像以視覺方式放置在設計工具上所有其他圖像的上方,而放置方式則是以自訂圖像的 Priority 值為基礎。 較低的 Priority 屬性值表示擁有較高的優先權,因此會在活動設計工具上最上層的疊置順序位置繪製圖像。

給實施者的注意事項

當您繼承自 DesignerGlyph 時,您必須覆寫下列成員:OnPaint(Graphics, Boolean, AmbientTheme, ActivityDesigner)

建構函式

DesignerGlyph()
已淘汰.

在衍生類別中實作時,初始化 DesignerGlyph 類別的新執行個體。

欄位

HighestPriority
已淘汰.

表示 DesignerGlyph 最高的可能優先權。 這個值是常數。

LowestPriority
已淘汰.

表示 DesignerGlyph 最低的可能優先權。 這個值是常數。

NormalPriority
已淘汰.

代表 DesignerGlyph 的一般優先權。 這個值是常數。

屬性

CanBeActivated
已淘汰.

取得值,指出 DesignerGlyph 是否可以在與其相關的 ActivityDesigner 上取得焦點。

Priority
已淘汰.

取得設計工具圖像在活動設計介面上的優先權設定。

方法

Equals(Object)
已淘汰.

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetBounds(ActivityDesigner, Boolean)
已淘汰.

傳回特定 ActivityDesigner 上的圖像界限。

GetHashCode()
已淘汰.

做為預設雜湊函式。

(繼承來源 Object)
GetType()
已淘汰.

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()
已淘汰.

建立目前 Object 的淺層複製。

(繼承來源 Object)
OnActivate(ActivityDesigner)
已淘汰.

指示圖像,啟動圖像的動作已經執行。

OnPaint(Graphics, Boolean, AmbientTheme, ActivityDesigner)
已淘汰.

在衍生類別中覆寫時,請執行任何轉譯活動設計工具介面上圖像時所需的工作。

ToString()
已淘汰.

傳回代表目前物件的字串。

(繼承來源 Object)

適用於

另請參閱