Example #1
0
        private UCLine MakeLine(RunLineModel mode)
        {
            var line = new UCLine();

            line.Height             = 15;
            line.Cursor             = Cursors.Hand;
            line.Background         = Brushes.Gray;
            line.MouseLeftButtonUp += Line_MouseLeftButtonUp;
            return(line);
        }
Example #2
0
        /// <summary>
        /// 添加节点与节点间的连线
        /// </summary>
        /// <param name="sourceNode"></param>
        /// <param name="objNode"></param>
        private UCLine AddLine(UCNode sourceNode)
        {
            var lineMode = new RunLineModel();

            lineMode.StartNode = nodeDic[sourceNode];

            var line = MakeLine(lineMode);
            var x    = sourceNode.X - sourceNode.Width / 2;
            var y    = sourceNode.Y - sourceNode.Height / 2;

            line.StartPoint = new Point(x, y);
            line.EndPoint   = new Point(x, y);
            canvasPanel.Children.Add(line);
            runLineDic.Add(line, lineMode);
            return(line);
        }
Example #3
0
        /// <summary>
        /// 添加节点与节点间的连线
        /// </summary>
        /// <param name="sourceNode"></param>
        /// <param name="objNode"></param>
        private void AddLine(UCNode sourceNode, UCNode objNode)
        {
            var lineMode = new RunLineModel();

            var line = new UCLine();
            var x    = sourceNode.X * canvasPanel.ActualWidth - sourceNode.Width / 2;
            var y    = sourceNode.Y * canvasPanel.ActualHeight - sourceNode.Height / 2;

            line.StartPoint = new Point(x, y);
            if (objNode != null)
            {
                x             = objNode.X * canvasPanel.ActualWidth - objNode.Width / 2;
                y             = objNode.Y * canvasPanel.ActualHeight - objNode.Height / 2;
                line.EndPoint = new Point(x, y);
            }
            canvasPanel.Children.Add(line);
            runLineDic.Add(line, lineMode);
        }