ActivityDesignerPaint クラス

定義

注意事項

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

アクティビティ デザイナー画面にユーザー インターフェイスの要素を描画するのに使用される静的メソッドを提供します。 このクラスは継承できません。

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

注釈

注意

ここでは、廃止された型と名前空間について説明します。 詳細については、「.NET 4.5 での Windows Workflow Foundation の新機能」を参照してください。

メソッド

Draw3DButton(Graphics, Image, Rectangle, Single, ButtonState)
古い.

アクティビティ デザイナー画面に 3 次元ボタンを描画します。

DrawExpandButton(Graphics, Rectangle, Boolean, CompositeDesignerTheme)
古い.

アクティビティ デザイナー画面上の複合デザイナーを展開および折りたたむのに使用されるボタンを描画します。

DrawImage(Graphics, Image, Rectangle, DesignerContentAlignment)
古い.

GraphicsImageRectangle、および DesignerContentAlignment を使用して、アクティビティ デザイナー画面にイメージを描画します。

DrawImage(Graphics, Image, Rectangle, Rectangle, DesignerContentAlignment, Single, Boolean)
古い.

GraphicsImageRectangleDesignerContentAlignment、単精度浮動小数点数、およびブール値を使用して、アクティビティ デザイナー画面にイメージを描画します。

DrawRoundedRectangle(Graphics, Pen, Rectangle, Int32)
古い.

アクティビティ デザイナー画面に丸みのある四角形を描画します。

DrawText(Graphics, Font, String, Rectangle, StringAlignment, TextQuality, Brush)
古い.

アクティビティ デザイナー画面にテキストを描画します。

GetRoundedRectanglePath(Rectangle, Int32)
古い.

指定した丸みのある四角形を描画するのに使用されるグラフィックス パスを返します。

適用対象