ActivityDesignerPaint 클래스

정의

주의

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

Activity Designer 화면에 사용자 인터페이스 요소를 그리는 데 사용되는 정적 메서드를 제공합니다. 이 클래스는 상속될 수 없습니다.

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
상속
ActivityDesignerPaint
특성

예제

다음 예제에서는 ActivityDesignerPaint 클래스를 사용하여 워크플로 디자인 화면에 사용자 지정 활동을 그리는 방법을 보여 줍니다. 먼저 DrawRoundedRectangle 메서드를 사용하여 모퉁이가 둥근 사각형을 그립니다. 그런 다음 DrawText를 사용하여 텍스트를 그리고 TextRectangleActivityDesigner 위치에 배치합니다. 또한 Image 클래스의 ActivityDesigner 메서드를 사용하여 DrawImage와 연결된 ActivityDesignerPaint를 그립니다. 마지막으로 CompositeActivity에서 사용하는 확장명 단추를 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

설명

참고

이 자료에서는 더 이상 사용되지 않는 형식과 네임스페이스에 대해 설명합니다. 자세한 내용은 Deprecated Types in Windows Workflow Foundation 4.5(Windows Workflow Foundation 4.5에서 사용되지 않는 형식)를 참조하세요.

메서드

Draw3DButton(Graphics, Image, Rectangle, Single, ButtonState)
사용되지 않음.

Activity Designer 화면에 3차원 단추를 그립니다.

DrawExpandButton(Graphics, Rectangle, Boolean, CompositeDesignerTheme)
사용되지 않음.

활동 디자이너 화면에서 복합 디자이너를 확장명 및 축소하는 데 사용되는 단추를 그립니다.

DrawImage(Graphics, Image, Rectangle, DesignerContentAlignment)
사용되지 않음.

Graphics, Image, RectangleDesignerContentAlignment을 사용하여 활동 디자이너 화면에 이미지를 그립니다.

DrawImage(Graphics, Image, Rectangle, Rectangle, DesignerContentAlignment, Single, Boolean)
사용되지 않음.

Graphics, Image, 소스 및 대상 Rectangle, DesignerContentAlignment, 단정밀도 부동 소수점 숫자 및 Boolean 값을 사용하여 활동 디자이너에 이미지를 그립니다.

DrawRoundedRectangle(Graphics, Pen, Rectangle, Int32)
사용되지 않음.

활동 디자이너 화면에서 모퉁이가 둥근 사각형을 그립니다.

DrawText(Graphics, Font, String, Rectangle, StringAlignment, TextQuality, Brush)
사용되지 않음.

Activity Designer 화면에 이미지를 그립니다.

GetRoundedRectanglePath(Rectangle, Int32)
사용되지 않음.

지정된 모퉁이가 둥근 사각형을 그리는 데 사용되는 그래픽 경로를 반환합니다.

적용 대상