ActivityDesignerPaint Class

 
Note: This API is now obsolete.

Provides static methods used to draw user interface elements on activity designer surfaces. This class cannot be inherited.

Namespace:   System.Workflow.ComponentModel.Design
Assembly:  System.Workflow.ComponentModel (in System.Workflow.ComponentModel.dll)

System.Object
  System.Workflow.ComponentModel.Design.ActivityDesignerPaint

[ObsoleteAttribute("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public static class ActivityDesignerPaint

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticDraw3DButton(Graphics, Image, Rectangle, Single, ButtonState)

Draws a 3-dimensional button on the activity designer surface.

System_CAPS_pubmethodSystem_CAPS_staticDrawExpandButton(Graphics, Rectangle, Boolean, CompositeDesignerTheme)

Draws a button that is used to expand and collapse composite designers on the activity designer surface.

System_CAPS_pubmethodSystem_CAPS_staticDrawImage(Graphics, Image, Rectangle, DesignerContentAlignment)

Draws an image on the activity designer surface by using a Graphics, an Image, a Rectangle, and a DesignerContentAlignment.

System_CAPS_pubmethodSystem_CAPS_staticDrawImage(Graphics, Image, Rectangle, Rectangle, DesignerContentAlignment, Single, Boolean)

Draws an image on the activity designer surface by using a Graphics, an Image, a source and destination Rectangle, an DesignerContentAlignment, a single-precision floating-point number, and a Boolean value.

System_CAPS_pubmethodSystem_CAPS_staticDrawRoundedRectangle(Graphics, Pen, Rectangle, Int32)

Draws a rounded rectangle on the activity designer surface.

System_CAPS_pubmethodSystem_CAPS_staticDrawText(Graphics, Font, String, Rectangle, StringAlignment, TextQuality, Brush)

Draws text on the activity designer surface.

System_CAPS_pubmethodSystem_CAPS_staticGetRoundedRectanglePath(Rectangle, Int32)

Returns the graphics path used to draw the specified rounded rectangle.

System_CAPS_noteNote

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

The following example demonstrates a way to use the ActivityDesignerPaint class to draw a custom activity on the workflow design surface. A rounded rectangle is first drawn using the DrawRoundedRectangle method. Text is then drawn using DrawText and is placed at the location of the TextRectangle of the ActivityDesigner. Additionally, the Image associated with the ActivityDesigner is drawn using the DrawImage method of the ActivityDesignerPaint class. Finally, an expand button used by a CompositeActivity is drawn using the DrawExpandButton.

private bool expanded = true;
private bool useBasePaint = false;

public bool UseBasePaint
{
    get { return this.useBasePaint; }
    set { this.useBasePaint = value; }
}

public bool Expanded
{
    get { return this.expanded; }
    set { this.expanded = value; }
}

protected override void OnPaint(ActivityDesignerPaintEventArgs e)
{
    if (this.UseBasePaint == true)
    {
        base.OnPaint(e);
        return;
    }

    DrawCustomActivity(e);
}

private void DrawCustomActivity(ActivityDesignerPaintEventArgs e)
{
    Graphics graphics = e.Graphics;

    CompositeDesignerTheme compositeDesignerTheme = (CompositeDesignerTheme)e.DesignerTheme;

    ActivityDesignerPaint.DrawRoundedRectangle(graphics, compositeDesignerTheme.BorderPen, this.Bounds, compositeDesignerTheme.BorderWidth);

    string text = this.Text;
    Rectangle textRectangle = this.TextRectangle;
    if (!String.IsNullOrEmpty(text) && !textRectangle.IsEmpty)
    {
        ActivityDesignerPaint.DrawText(graphics, compositeDesignerTheme.Font, text, textRectangle, StringAlignment.Center, e.AmbientTheme.TextQuality, compositeDesignerTheme.ForegroundBrush);
    }

    System.Drawing.Image image = this.Image;
    Rectangle imageRectangle = this.ImageRectangle;
    if (image != null && !imageRectangle.IsEmpty)
    {
        ActivityDesignerPaint.DrawImage(graphics, image, imageRectangle, DesignerContentAlignment.Fill);
    }

    ActivityDesignerPaint.DrawExpandButton(graphics,
        new Rectangle(this.Location.X, this.Location.Y, 10, 10),
        this.Expanded,
        compositeDesignerTheme);
}

.NET Framework
Available since 3.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: