ActivityDesignerPaint Klasa

Definicja

Przestroga

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

Udostępnia metody statyczne używane do rysowania elementów interfejsu użytkownika na powierzchniach projektanta działań. Klasa ta nie może być dziedziczona.

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

Przykłady

W poniższym przykładzie pokazano sposób użycia ActivityDesignerPaint klasy do rysowania niestandardowego działania na powierzchni projektowej przepływu pracy. Zaokrąglony prostokąt jest najpierw rysowany przy użyciu DrawRoundedRectangle metody . Tekst jest następnie rysowany przy użyciu elementu DrawText i jest umieszczany w lokalizacji TextRectangle obiektu ActivityDesigner. Image Ponadto element skojarzony z elementem ActivityDesigner jest rysowany przy użyciu DrawImage metody ActivityDesignerPaint klasy . Na koniec przycisk rozwijania używany przez obiekt CompositeActivity jest rysowany przy użyciu elementu 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

Uwagi

Uwaga

W tym materiale omówiono przestarzałe typy i przestrzenie nazw. Aby uzyskać więcej informacji, zobacz Przestarzałe typy w programie Windows Workflow Foundation 4.5.

Metody

Draw3DButton(Graphics, Image, Rectangle, Single, ButtonState)
Przestarzałe.

Rysuje 3-wymiarowy przycisk na powierzchni projektanta działań.

DrawExpandButton(Graphics, Rectangle, Boolean, CompositeDesignerTheme)
Przestarzałe.

Rysuje przycisk służący do rozwijania i zwijania projektantów złożonych na powierzchni projektanta działań.

DrawImage(Graphics, Image, Rectangle, DesignerContentAlignment)
Przestarzałe.

Rysuje obraz na powierzchni projektanta działań przy użyciu Graphicselementu , , Imagea Rectanglei DesignerContentAlignment.

DrawImage(Graphics, Image, Rectangle, Rectangle, DesignerContentAlignment, Single, Boolean)
Przestarzałe.

Rysuje obraz na powierzchni projektanta działań przy użyciu Graphicswartości , , Imageźródła i miejsca docelowego Rectangle, liczby DesignerContentAlignmentzmiennoprzecinkowej o pojedynczej precyzji i wartości logicznej.

DrawRoundedRectangle(Graphics, Pen, Rectangle, Int32)
Przestarzałe.

Rysuje zaokrąglony prostokąt na powierzchni projektanta działań.

DrawText(Graphics, Font, String, Rectangle, StringAlignment, TextQuality, Brush)
Przestarzałe.

Rysuje tekst na powierzchni projektanta działań.

GetRoundedRectanglePath(Rectangle, Int32)
Przestarzałe.

Zwraca ścieżkę grafiki używaną do rysowania określonego zaokrąglonego prostokąta.

Dotyczy