示例#1
0
 public ConnectorAdorner(DesignerCanvas designer, Connector sourceConnector)
     : base(designer)
 {
     this.designerCanvas = designer;
     this.sourceConnector = sourceConnector;
     drawingPen = new Pen(Brushes.LightSlateGray, 1);
     drawingPen.LineJoin = PenLineJoin.Round;
     this.Cursor = Cursors.Cross;
 }
示例#2
0
 public Connection(Connector source, Connector sink)
 {
     this.ID = Guid.NewGuid();
     this.Source = source;
     this.Sink = sink;
     base.Unloaded += new RoutedEventHandler(Connection_Unloaded);
 }
示例#3
0
        private void HitTesting(Point hitPoint)
        {
            bool hitConnectorFlag = false;

            DependencyObject hitObject = designerCanvas.InputHitTest(hitPoint) as DependencyObject;
            while (hitObject != null &&
                   hitObject != sourceConnector.ParentDesignerItem &&
                   hitObject.GetType() != typeof(DesignerCanvas))
            {
                if (hitObject is Connector)
                {
                    HitConnector = hitObject as Connector;
                    hitConnectorFlag = true;
                }

                if (hitObject is DesignerItem)
                {
                    HitDesignerItem = hitObject as DesignerItem;
                    if (!hitConnectorFlag)
                        HitConnector = null;
                    return;
                }
                hitObject = VisualTreeHelper.GetParent(hitObject);
            }

            HitConnector = null;
            HitDesignerItem = null;
        }
示例#4
0
        void thumbDragThumb_DragStarted(object sender, DragStartedEventArgs e)
        {
            this.HitDesignerItem = null;
            this.HitConnector = null;
            this.pathGeometry = null;
            this.Cursor = Cursors.Cross;
            this.connection.StrokeDashArray = new DoubleCollection(new double[] { 1, 2 });

            if (sender == sourceDragThumb)
            {
                fixConnector = connection.Sink;
                dragConnector = connection.Source;
            }
            else if (sender == sinkDragThumb)
            {
                dragConnector = connection.Sink;
                fixConnector = connection.Source;
            }
        }