ActivityDesigner.OnPaint(ActivityDesignerPaintEventArgs) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
디자인 타임에 활동의 시각적 표시를 그립니다.
protected:
virtual void OnPaint(System::Workflow::ComponentModel::Design::ActivityDesignerPaintEventArgs ^ e);
protected virtual void OnPaint (System.Workflow.ComponentModel.Design.ActivityDesignerPaintEventArgs e);
abstract member OnPaint : System.Workflow.ComponentModel.Design.ActivityDesignerPaintEventArgs -> unit
override this.OnPaint : System.Workflow.ComponentModel.Design.ActivityDesignerPaintEventArgs -> unit
Protected Overridable Sub OnPaint (e As ActivityDesignerPaintEventArgs)
매개 변수
이벤트 데이터가 포함된 ActivityDesignerPaintEventArgs입니다.
예외
e
에 null 참조(Visual Basic의 경우 Nothing
)가 포함된 경우
예제
다음 예제에서는 그리기 책임을 기본 클래스에 위임하거나 Boolean 값을 바탕으로 자신을 그리는 사용자 지정 ActivityDesigner를 보여 줍니다.
useBasePaint
가 false인 경우에는 사용자 지정 활동이 ActivityDesignerPaint 클래스의 다양한 메서드를 사용하여 자신을 그립니다.
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
적용 대상
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET