Redigera

Dela via


DesignerGlyph Class

Definition

Caution

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

Draws a glyph at the top-most Z order position on an activity designer.

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
Inheritance
DesignerGlyph
Derived
Attributes

Examples

The following code example demonstrates a glyph class that derives from the DesignerGlyph class. The code overrides the GetBounds and OnPaint methods.

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

Remarks

Note

This material discusses types and namespaces that are obsolete. For more information, see Deprecated Types in Windows Workflow Foundation 4.5.

The DesignerGlyph class is the base class for all designer glyphs used on a workflow design surface.

Activity designer developers can use classes that inherit from DesignerGlyph to draw custom glyphs onto the surface of an ActivityDesigner. 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. 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.

Notes to Implementers

When you inherit from DesignerGlyph, you must override the following members: OnPaint(Graphics, Boolean, AmbientTheme, ActivityDesigner).

Constructors

DesignerGlyph()

When implemented in a derived class, initializes a new instance of the DesignerGlyph class.

Fields

HighestPriority

Represents the highest priority possible for a DesignerGlyph. This value is a constant.

LowestPriority

Represents the lowest priority possible for a DesignerGlyph. This value is a constant.

NormalPriority

Represents the normal priority for a DesignerGlyph. This value is a constant.

Properties

CanBeActivated

Gets a value indicating whether the DesignerGlyph can gain focus on the ActivityDesigner with which it is associated.

Priority

Gets the priority setting for the designer glyph on the activity design surface.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetBounds(ActivityDesigner, Boolean)

Returns the bounds for the glyph on the specified ActivityDesigner.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OnActivate(ActivityDesigner)

Indicates to the glyph that an action has been performed which has activated the glyph.

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()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also