Esempio n. 1
0
        public void LoadShape(ShapeBase shape, Viewport viewport)
        {
            _shape = shape;
            _viewport = viewport;

            foreach (var ctrl in _controlPoints)
            {
                ctrl.LocationChanged -= Control_LocationChanged;
            }
            _controlPoints.Clear();

            foreach (var v in _shape.Vertices)
            {
                var control = new ControlPoint((int)Math.Round(v.X), (int)Math.Round(v.Y), null);
                control.LocationChanged += Control_LocationChanged;
                control.Tag = v;
                control.Cursor = Cursors.SizeAll;
                _controlPoints.Add(control);
            }

            if (_shape.GetShapeType() == ShapeType.Ellipse)
            {
                _controlPoints.Add(new ControlPoint((int) Math.Round(_shape.Location.X + _shape.Size.Width/2),
                    (int) Math.Round(_shape.Location.Y), null));

                _controlPoints.Add(new ControlPoint((int)Math.Round(_shape.Location.X + _shape.Size.Width),
                    (int)Math.Round(_shape.Location.Y + _shape.Size.Height/2), null));

                _controlPoints.Add(new ControlPoint((int)Math.Round(_shape.Location.X + _shape.Size.Width/2),
                    (int)Math.Round(_shape.Location.Y + _shape.Size.Height), null));

                _controlPoints.Add(new ControlPoint((int)Math.Round(_shape.Location.X),
                    (int)Math.Round(_shape.Location.Y + _shape.Size.Height/2), null));

            }
        }
Esempio n. 2
0
 public void AddControlDependY(ControlPoint point)
 {
     _controlDependY.Add(point);
 }