Ejemplo n.º 1
0
        public Outline(Point center)
        {
            var sideLength = 50;
            center.Offset(-sideLength / 2, -sideLength/2);
            nodes.Add(PanAndZoom.fromLocalToGlobal(center));

            center.Offset(0, sideLength);
            nodes.Add(PanAndZoom.fromLocalToGlobal(center));

            center.Offset(sideLength, 0);
            nodes.Add(PanAndZoom.fromLocalToGlobal(center));

            center.Offset(0, -sideLength);
            nodes.Add(PanAndZoom.fromLocalToGlobal(center));

            //parent.Controls.Add(this);
            //BringToFront();

            foreach(var n in nodes){
                var marker = new VertexMarker();
                marker.setPosition(n);
                marker.MouseClick += new MouseEventHandler(deleteMarker);
                markers.Add(marker);

                marker.BringToFront();

                var c = new CreaterMarker();
                c.MouseClick += new MouseEventHandler(createMarker);
                //parent.Controls.Add(c);
                creaters.Add(c);
            }
            paintEvent = new PaintEventHandler(paint);
        }
Ejemplo n.º 2
0
        public Outline(List<Point> nodes)
        {
            this.nodes = nodes;
            foreach (var n in nodes)
            {
                var marker = new VertexMarker();
                marker.setPosition(n);
                marker.MouseClick += new MouseEventHandler(deleteMarker);
                markers.Add(marker);

                marker.BringToFront();

                var c = new CreaterMarker();
                c.MouseClick += new MouseEventHandler(createMarker);
                //parent.Controls.Add(c);
                creaters.Add(c);
            }
            paintEvent = new PaintEventHandler(paint);
        }
Ejemplo n.º 3
0
        public void createMarker(object obj, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left) return;
            var creater = (CreaterMarker)obj;

            var marker = new VertexMarker();
            marker.setPosition(creater.getPosition());
            marker.MouseClick += new MouseEventHandler(deleteMarker);
            markers.Insert(creaters.IndexOf(creater)+1,marker);
            parent.Controls.Add(marker);
            marker.BringToFront();

            var c = new CreaterMarker();
            c.MouseClick += new MouseEventHandler(createMarker);
            parent.Controls.Add(c);
            creaters.Insert(creaters.IndexOf(creater)+1, c);

            parent.Invalidate();
        }