Exemple #1
0
        public void MouseLeftButtonUp_CreateArrow(object sender, MouseButtonEventArgs e)
        {
            canvas.MouseMove -= MouseMove_ArrowDrawing;

            if (classBox is ClassBox)
            {
                Point classBoxPoint = classBox.TransformToAncestor(canvas).Transform(new Point(0, 0));
                Point pt            = new Point(classBoxPoint.X + classBox.ActualWidth / 2, classBoxPoint.Y + classBox.ActualHeight / 2);
                classBox.linkPoint = pt;
                arrow.X2           = pt.X;
                arrow.Y2           = pt.Y;
                classBox.arrowLinesTo.Add(arrow);
            }
            else
            {
                canvas.Children.Remove(arrow);
                arrow = null;
            }

            foreach (object obj in canvas.Children)
            {
                if (obj is ClassBox)
                {
                    ClassBox cb = (ClassBox)obj;
                    cb.MouseLeftButtonDown -= MouseLeftButtonDown_CreateArrow;
                    cb.MouseLeftButtonDown += MouseLeftButtonDown_groupClassBox;
                    cb.MouseLeftButtonUp   -= MouseLeftButtonUp_CreateArrow;
                }
            }

            canvas.MouseLeftButtonUp -= MouseLeftButtonUp_CreateArrow;
        }
Exemple #2
0
        private void CreateLinkBetweenClassBoxes()
        {
            arrow                 = new ArrowLine();
            arrow.Stroke          = Brushes.White;
            arrow.StrokeThickness = 5;

            foreach (object obj in canvas.Children)
            {
                if (obj is ClassBox)
                {
                    ClassBox classBox = (ClassBox)obj;
                    classBox.MouseLeftButtonDown -= MouseLeftButtonDown_groupClassBox;
                    classBox.MouseLeftButtonDown += MouseLeftButtonDown_CreateArrow;
                    classBox.MouseLeftButtonUp   += MouseLeftButtonUp_CreateArrow;
                }
            }

            canvas.MouseLeftButtonUp += MouseLeftButtonUp_CreateArrow;
        }