ActivityDesignerPaint ActivityDesignerPaint ActivityDesignerPaint ActivityDesignerPaint Class

Definition

Warnung

Diese API ist jetzt veraltet.

Stellt statische Methoden bereit, die verwendet werden, um Benutzeroberflächenelemente auf Aktivitätsdesigneroberflächen zu zeichnen.Provides static methods used to draw user interface elements on activity designer surfaces. Diese Klasse kann nicht vererbt werden.This class cannot be inherited.

public ref class ActivityDesignerPaint abstract sealed
[System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public static class ActivityDesignerPaint
type ActivityDesignerPaint = class
Public Class ActivityDesignerPaint
Vererbung
ActivityDesignerPaintActivityDesignerPaintActivityDesignerPaintActivityDesignerPaint
Attribute

Beispiele

Das folgende Beispiel zeigt, wie die ActivityDesignerPaint-Klasse verwendet werden kann, um eine benutzerdefinierte Aktivität auf der Workflowentwurfsoberfläche zu zeichnen.The following example demonstrates a way to use the ActivityDesignerPaint class to draw a custom activity on the workflow design surface. Zunächst wird mit der DrawRoundedRectangle-Methode ein abgerundetes Rechteck gezeichnet.A rounded rectangle is first drawn using the DrawRoundedRectangle method. Anschließend wird Text anhand von DrawText gezeichnet und an der TextRectangle-Position von ActivityDesigner platziert.Text is then drawn using DrawText and is placed at the location of the TextRectangle of the ActivityDesigner. Darüber hinaus wird das Image zugeordnete ActivityDesigner mithilfe der DrawImage-Methode der ActivityDesignerPaint-Klasse gezeichnet.Additionally, the Image associated with the ActivityDesigner is drawn using the DrawImage method of the ActivityDesignerPaint class. Zum Schluss wird eine von CompositeActivity verwendete Erweiterungsschaltfläche mit DrawExpandButton gezeichnet.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);
}
Private expandedValue As Boolean = True
Private useBasePaintValue As Boolean = False

Public Property UseBasePaint() As Boolean
    Get
        Return Me.useBasePaintValue
    End Get

    Set(ByVal value As Boolean)
        Me.useBasePaintValue = value
    End Set
End Property

Public Property Expanded() As Boolean
    Get
        Return Me.expandedValue
    End Get
    Set(ByVal value As Boolean)
        Me.expandedValue = value
    End Set
End Property


Protected Overrides Sub OnPaint(ByVal e As ActivityDesignerPaintEventArgs)
    If Me.UseBasePaint = True Then
        MyBase.OnPaint(e)
        Return
    End If

    DrawCustomActivity(e)
End Sub

Private Sub DrawCustomActivity(ByVal e As ActivityDesignerPaintEventArgs)
    Dim graphics As Graphics = e.Graphics

    Dim compositeDesignerTheme As CompositeDesignerTheme = CType(e.DesignerTheme, CompositeDesignerTheme)

    ActivityDesignerPaint.DrawRoundedRectangle(graphics, compositeDesignerTheme.BorderPen, Me.Bounds, compositeDesignerTheme.BorderWidth)

    Dim text As String = Me.Text
    Dim TextRectangle As Rectangle = Me.TextRectangle
    If Not String.IsNullOrEmpty(text) And Not TextRectangle.IsEmpty Then
        ActivityDesignerPaint.DrawText(graphics, compositeDesignerTheme.Font, text, TextRectangle, StringAlignment.Center, e.AmbientTheme.TextQuality, compositeDesignerTheme.ForegroundBrush)
    End If

    Dim Image As System.Drawing.Image = Me.Image
    Dim ImageRectangle As Rectangle = Me.ImageRectangle
    If Image IsNot Nothing And Not ImageRectangle.IsEmpty Then
        ActivityDesignerPaint.DrawImage(graphics, Image, ImageRectangle, DesignerContentAlignment.Fill)
    End If

    ActivityDesignerPaint.DrawExpandButton(graphics, _
        New Rectangle(Me.Location.X, Me.Location.Y, 10, 10), _
        Me.Expanded, _
        compositeDesignerTheme)
End Sub

Hinweise

Hinweis

In diesem Material werden veraltete Typen und Namespaces erläutert.This material discusses types and namespaces that are obsolete. Weitere Informationen finden Sie unter Veraltete Typen in Windows Workflow Foundation 4.5.For more information, see Deprecated Types in Windows Workflow Foundation 4.5.

Methoden

Draw3DButton(Graphics, Image, Rectangle, Single, ButtonState) Draw3DButton(Graphics, Image, Rectangle, Single, ButtonState) Draw3DButton(Graphics, Image, Rectangle, Single, ButtonState) Draw3DButton(Graphics, Image, Rectangle, Single, ButtonState)

Zeichnet eine dreidimensionale Schaltfläche auf der Aktivitätsdesigneroberfläche.Draws a 3-dimensional button on the activity designer surface.

DrawExpandButton(Graphics, Rectangle, Boolean, CompositeDesignerTheme) DrawExpandButton(Graphics, Rectangle, Boolean, CompositeDesignerTheme) DrawExpandButton(Graphics, Rectangle, Boolean, CompositeDesignerTheme) DrawExpandButton(Graphics, Rectangle, Boolean, CompositeDesignerTheme)

Zeichnet eine Schaltfläche, die verwendet wird, um zusammengesetzte Designer auf der Aktivitätsdesigneroberfläche zu erweitern und zu reduzieren.Draws a button that is used to expand and collapse composite designers on the activity designer surface.

DrawImage(Graphics, Image, Rectangle, DesignerContentAlignment) DrawImage(Graphics, Image, Rectangle, DesignerContentAlignment) DrawImage(Graphics, Image, Rectangle, DesignerContentAlignment) DrawImage(Graphics, Image, Rectangle, DesignerContentAlignment)

Zeichnet unter Verwendung von Graphics, Image, Rectangle und DesignerContentAlignment ein Bild auf der Aktivitätsdesigneroberfläche.Draws an image on the activity designer surface by using a Graphics, an Image, a Rectangle, and a DesignerContentAlignment.

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

Zeichnet unter Verwendung von Graphics, Image, eines Quell- und Ziel-Rectangle, DesignerContentAlignment, einer Gleitkommazahl mit einfacher Genauigkeit und eines booleschen Werts ein Bild auf der Aktivitätsdesigneroberfläche.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.

DrawRoundedRectangle(Graphics, Pen, Rectangle, Int32) DrawRoundedRectangle(Graphics, Pen, Rectangle, Int32) DrawRoundedRectangle(Graphics, Pen, Rectangle, Int32) DrawRoundedRectangle(Graphics, Pen, Rectangle, Int32)

Zeichnet ein abgerundetes Rechteck auf der Aktivitätsdesigneroberfläche.Draws a rounded rectangle on the activity designer surface.

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

Zeichnet Text auf der Aktivitätsdesigneroberfläche.Draws text on the activity designer surface.

GetRoundedRectanglePath(Rectangle, Int32) GetRoundedRectanglePath(Rectangle, Int32) GetRoundedRectanglePath(Rectangle, Int32) GetRoundedRectanglePath(Rectangle, Int32)

Gibt den Grafikpfad zurück, der zum Zeichnen des angegebenen abgerundeten Rechtecks verwendet wird.Returns the graphics path used to draw the specified rounded rectangle.

Gilt für: