示例#1
0
        public ControlLine(ControlLineCanvas controlLineCanvas, double x, double y)
        {
            ControlLineCanvas = controlLineCanvas;

            Start = new ControlLineStartThumb(this, x, y);
            Mid   = new ControlLineMidThumb(this, x, y);
            End   = new ControlLineEndThumb(this, x, y);

            Line                 = new LineGeometry();
            Path                 = new Path();
            Path.Stroke          = Brushes.LimeGreen;
            Path.StrokeThickness = 1;
            Path.Data            = Line;
            ControlLineCanvas.canvas.Children.Add(Path);
        }
示例#2
0
        public ControlLine(ControlLineCanvas controlLineCanvas, ControlLine controlLine)
        {
            ControlLineCanvas = controlLineCanvas;

            Point startPos = controlLine.Start.GetPos();
            Point endPos   = controlLine.End.GetPos();

            Start = new ControlLineStartThumb(this, startPos.X, startPos.Y);
            End   = new ControlLineEndThumb(this, endPos.X, endPos.Y);
            Vector v = Point.Subtract(startPos, endPos);

            Mid = new ControlLineMidThumb(this, endPos.X + v.X / 2, endPos.Y + v.Y / 2);
            Canvas.SetZIndex(End, 2);

            Line                 = new LineGeometry();
            Path                 = new Path();
            Path.Stroke          = Brushes.LimeGreen;
            Path.StrokeThickness = 1;
            Path.Data            = Line;
            ControlLineCanvas.canvas.Children.Add(Path);
            UpdateLine();
        }