DesignerGlyph.OnActivate(ActivityDesigner) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
문자 모양을 활성화한 작업이 수행된 문자 모양을 나타냅니다.
protected:
virtual void OnActivate(System::Workflow::ComponentModel::Design::ActivityDesigner ^ designer);
protected virtual void OnActivate (System.Workflow.ComponentModel.Design.ActivityDesigner designer);
abstract member OnActivate : System.Workflow.ComponentModel.Design.ActivityDesigner -> unit
override this.OnActivate : System.Workflow.ComponentModel.Design.ActivityDesigner -> unit
Protected Overridable Sub OnActivate (designer As ActivityDesigner)
매개 변수
- designer
- ActivityDesigner
문자 모양이 그려질 ActivityDesigner입니다.
예제
다음 예제에서는 OnActivate 메서드의 구현을 보여 줍니다. 이 예제는 Tracking Profile Designer SDK 샘플에 포함되어 있습니다. 자세한 내용은 Tracking Profile Designer 샘플합니다.
/// <summary>
/// This glyph shows that the activity's track point is not correctly configured
/// </summary>
internal sealed class ErrorActivityGlyph : DesignerGlyph
{
static Bitmap image = Resources.error;
string errorMessage;
internal ErrorActivityGlyph(string errorMessage)
{
this.errorMessage = errorMessage;
}
public override bool CanBeActivated
{
get
{
return true;
}
}
/// <summary>
/// Display an error message when this glyph is clicked
/// </summary>
/// <param name="designer"></param>
protected override void OnActivate(ActivityDesigner designer)
{
MessageBox.Show(errorMessage);
}
public override Rectangle GetBounds(ActivityDesigner designer, bool activated)
{
Rectangle imageBounds = new Rectangle();
if (image != null)
{
imageBounds.Size = image.Size;
imageBounds.Location = new Point(designer.Bounds.Right - imageBounds.Size.Width / 4, designer.Bounds.Top - imageBounds.Size.Height / 2);
}
return imageBounds;
}
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer)
{
image.MakeTransparent(Color.FromArgb(255, 255, 255));
if (image != null)
{
graphics.DrawImage(image, GetBounds(designer, activated), new Rectangle(Point.Empty, image.Size), GraphicsUnit.Pixel);
}
}
}
' This glyph shows that the activity's track point is not correctly configured
Friend NotInheritable Class ErrorActivityGlyph
Inherits DesignerGlyph
Shared image As Bitmap = Resources.errorIcon
Dim errorMessage As String
Friend Sub New(ByVal errorMessage As String)
Me.errorMessage = errorMessage
End Sub
Public Overrides ReadOnly Property CanBeActivated() As Boolean
Get
Return True
End Get
End Property
' Display an error message when this glyph is clicked
Protected Overrides Sub OnActivate(ByVal designer As ActivityDesigner)
MessageBox.Show(errorMessage)
End Sub
Public Overrides Function GetBounds(ByVal designer As ActivityDesigner, ByVal activated As Boolean) As Rectangle
Dim imageBounds As New Rectangle()
If image IsNot Nothing Then
imageBounds.Size = image.Size
imageBounds.Location = New Point(designer.Bounds.Right - imageBounds.Size.Width / 4, designer.Bounds.Top - imageBounds.Size.Height / 2)
End If
Return imageBounds
End Function
Protected Overrides Sub OnPaint(ByVal graphics As Graphics, ByVal activated As Boolean, ByVal ambientTheme As AmbientTheme, ByVal designer As ActivityDesigner)
image.MakeTransparent(Color.FromArgb(255, 255, 255))
If image IsNot Nothing Then
graphics.DrawImage(image, GetBounds(designer, activated), New Rectangle(Point.Empty, image.Size), GraphicsUnit.Pixel)
End If
End Sub
End Class
적용 대상
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET