DesignerGlyph DesignerGlyph DesignerGlyph DesignerGlyph Class

定義

警告

此 API 現已淘汰。

在活動設計工具最上層的疊置順序位置繪製圖樣 (Glyph)。Draws a glyph at the top-most Z order position on an activity designer.

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

範例

下列程式碼範例示範從 DesignerGlyph 類別衍生的圖像類別。The following code example demonstrates a glyph class that derives from the DesignerGlyph class. 程式碼會覆寫 GetBoundsOnPaint 方法。The code overrides the GetBounds and OnPaint methods.

這個程式碼範例是 DesignerGlyphProvider.cs 檔案中<工作流程監視器 SDK>範例的一部分。This code example is part of the Workflow Monitor SDK Sample from the DesignerGlyphProvider.cs file. 如需詳細資訊, 請參閱工作流程監視器For more information, see Workflow Monitor.

//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

備註

注意

此資料討論已被汰換的類型及命名空間。This material discusses types and namespaces that are obsolete. 如需詳細資訊,請參閱 Windows Workflow Foundation 4.5 中即將淘汰的類型For more information, see Deprecated Types in Windows Workflow Foundation 4.5.

DesignerGlyph 類別為工作流程設計介面上使用之所有設計工具圖像的基底類別 (Base Class)。The DesignerGlyph class is the base class for all designer glyphs used on a workflow design surface.

活動設計工具開發人員可以使用繼承自 DesignerGlyph 的類別在 ActivityDesigner 介面上繪製自訂圖像。Activity designer developers can use classes that inherit from DesignerGlyph to draw custom glyphs onto the surface of an ActivityDesigner. DesignerGlyph 類別可在最上層的疊置順序繪製此類圖像,這會將自訂圖像以視覺方式放置在設計工具上所有其他圖像的上方,而放置方式則是以自訂圖像的 Priority 值為基礎。DesignerGlyph classes draw such glyphs at the top-level Z order, which places the custom glyph visually on top of all other glyphs on the designer based on the Priority value of the custom glyph. 較低的 Priority 屬性值表示擁有較高的優先權,因此會在活動設計工具上最上層的疊置順序位置繪製圖像。A lower value for the Priority property indicates a higher priority and therefore draws the glyph at the top-most Z order position on an activity designer.

給繼承者的注意事項

當您繼承自 DesignerGlyph 時,您必須覆寫下列成員:OnPaint(Graphics, Boolean, AmbientTheme, ActivityDesigner)When you inherit from DesignerGlyph, you must override the following members: OnPaint(Graphics, Boolean, AmbientTheme, ActivityDesigner).

建構函式

DesignerGlyph() DesignerGlyph() DesignerGlyph() DesignerGlyph()

在衍生類別中實作時,初始化 DesignerGlyph 類別的新執行個體。When implemented in a derived class, initializes a new instance of the DesignerGlyph class.

欄位

HighestPriority HighestPriority HighestPriority HighestPriority

表示 DesignerGlyph 最高的可能優先權。Represents the highest priority possible for a DesignerGlyph. 這個值是常數。This value is a constant.

LowestPriority LowestPriority LowestPriority LowestPriority

表示 DesignerGlyph 最低的可能優先權。Represents the lowest priority possible for a DesignerGlyph. 這個值是常數。This value is a constant.

NormalPriority NormalPriority NormalPriority NormalPriority

代表 DesignerGlyph 的一般優先權。Represents the normal priority for a DesignerGlyph. 這個值是常數。This value is a constant.

屬性

CanBeActivated CanBeActivated CanBeActivated CanBeActivated

取得值,指出 DesignerGlyph 是否可以在與其相關的 ActivityDesigner 上取得焦點。Gets a value indicating whether the DesignerGlyph can gain focus on the ActivityDesigner with which it is associated.

Priority Priority Priority Priority

取得設計工具圖像在活動設計介面上的優先權設定。Gets the priority setting for the designer glyph on the activity design surface.

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetBounds(ActivityDesigner, Boolean) GetBounds(ActivityDesigner, Boolean) GetBounds(ActivityDesigner, Boolean) GetBounds(ActivityDesigner, Boolean)

傳回特定 ActivityDesigner 上的圖像界限。Returns the bounds for the glyph on the specified ActivityDesigner.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
OnActivate(ActivityDesigner) OnActivate(ActivityDesigner) OnActivate(ActivityDesigner) OnActivate(ActivityDesigner)

指示圖像,啟動圖像的動作已經執行。Indicates to the glyph that an action has been performed which has activated the glyph.

OnPaint(Graphics, Boolean, AmbientTheme, ActivityDesigner) OnPaint(Graphics, Boolean, AmbientTheme, ActivityDesigner) OnPaint(Graphics, Boolean, AmbientTheme, ActivityDesigner) OnPaint(Graphics, Boolean, AmbientTheme, ActivityDesigner)

在衍生類別中覆寫時,請執行任何轉譯活動設計工具介面上圖像時所需的工作。When overridden in a derived class, performs any tasks required to render the glyph on the activity designer surface.

ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

適用於

另請參閱