FreeformActivityDesigner.AddConnector 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
커넥터를 FreeformActivityDesigner에 추가합니다.
public:
System::Workflow::ComponentModel::Design::Connector ^ AddConnector(System::Workflow::ComponentModel::Design::ConnectionPoint ^ source, System::Workflow::ComponentModel::Design::ConnectionPoint ^ target);
public System.Workflow.ComponentModel.Design.Connector AddConnector (System.Workflow.ComponentModel.Design.ConnectionPoint source, System.Workflow.ComponentModel.Design.ConnectionPoint target);
member this.AddConnector : System.Workflow.ComponentModel.Design.ConnectionPoint * System.Workflow.ComponentModel.Design.ConnectionPoint -> System.Workflow.ComponentModel.Design.Connector
Public Function AddConnector (source As ConnectionPoint, target As ConnectionPoint) As Connector
매개 변수
- source
- ConnectionPoint
커넥터 그리기를 시작하는 ConnectionPoint 위치입니다.
- target
- ConnectionPoint
커넥터 그리기를 종료하는 ConnectionPoint 위치입니다.
반환
Connector에 추가된 FreeformActivityDesigner입니다.
예외
source
또는 target
에 null
참조(Visual Basic의 경우 Nothing
)가 포함된 경우
AssociatedDesigner 또는 source
의 target
속성에 null
참조(Nothing
)가 포함된 경우
현재 FreeformActivityDesigner가 추가할 커넥터의 컨테이너가 아닌 경우
예제
다음 예제에서는 사용자 지정 활동 디자이너의 OnLayoutPosition
메서드에서 메서드를 사용하는 AddConnector
방법을 보여 줍니다.
class ProcessActvityDesigner : FreeformActivityDesigner
{
private ConnectionPoint GetConnectionPoint(Activity activity, Int32 connectorIndex, DesignerEdges edge)
{
ActivityDesigner designer = null;
if (activity != null && activity.Site != null)
{
IDesignerHost designerHost = activity.Site.GetService(typeof(IDesignerHost)) as IDesignerHost;
if (designerHost != null)
designer = designerHost.GetDesigner(activity) as ActivityDesigner;
}
return new ConnectionPoint(designer, edge, connectorIndex);
}
protected override void OnLayoutPosition(ActivityDesignerLayoutEventArgs e)
{
base.OnLayoutPosition(e);
// Draw a connector between the first and second activities contained in
// the sequence activity used by this designer
if (this.IsRootDesigner)
{
CompositeActivity parentActivity = (CompositeActivity)this.Activity;
ConnectionPoint sourcePoint = GetConnectionPoint(parentActivity.Activities[0], 1, DesignerEdges.Bottom);
ConnectionPoint targetPoint = GetConnectionPoint(parentActivity.Activities[1], 0, DesignerEdges.Top);
this.AddConnector(sourcePoint, targetPoint);
}
}
Class ProcessActvityDesigner
Inherits System.Workflow.ComponentModel.Design.FreeformActivityDesigner
Function GetConnectionPoint(ByVal activity As Activity, ByVal connectorIndex As Int32, ByVal edge As DesignerEdges) As ConnectionPoint
Dim designer As ActivityDesigner = Nothing
If Activity IsNot Nothing And Activity.Site IsNot Nothing Then
Dim designerHost As IDesignerHost = activity.Site.GetService(GetType(IDesignerHost))
If designerHost IsNot Nothing Then
designer = CType(designerHost.GetDesigner(activity), ActivityDesigner)
End If
End If
Return New ConnectionPoint(designer, edge, connectorIndex)
End Function
Protected Overrides Sub OnLayoutPosition(ByVal e As ActivityDesignerLayoutEventArgs)
MyBase.OnLayoutPosition(e)
' Draw a connector between the first and second activities contained in
' the sequence activity used by me designer
If Me.IsRootDesigner Then
Dim parentActivity As CompositeActivity = CType(Me.Activity, CompositeActivity)
Dim sourcePoint As ConnectionPoint = GetConnectionPoint(parentActivity.Activities(0), 1, DesignerEdges.Bottom)
Dim targetPoint As ConnectionPoint = GetConnectionPoint(parentActivity.Activities(1), 0, DesignerEdges.Top)
Me.AddConnector(sourcePoint, targetPoint)
End If
End Sub
End Class
설명
AddConnector 는 사용자가 .에 추가할 Connector 때 호출됩니다 FreeformActivityDesigner.