Ejemplo n.º 1
0
        public void OnMouseClick(GrPanel panel, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
                return;

            IGrObj grobj = panel.GetObjectUnder(e.X, e.Y);

            if (grobj != null && grobj is GrPoint)
            {
                _besie.Objects.Add(grobj as GrPoint);

                if (_besie.PointCount == 2)
                    panel.Edited.Objects.Add(_besie);

                panel.Invalidate();
            }
            else
            {
                GrPoint pnt = new GrPoint(null, e.X, e.Y);
                panel.Root.Objects.Add(pnt);

                _besie.Objects.Add(pnt);

                if (_besie.PointCount == 2)
                    panel.Edited.Objects.Add(_besie);

                panel.Invalidate();
            }
        }
Ejemplo n.º 2
0
Archivo: GrLine.cs Proyecto: virl/fresk
        public GrLine(IGrObj parent, GrPoint p1, GrPoint p2)
            : base(parent)
        {
            this.DrawningRegion.DrawningContours.Add(new BasicContour());

            _p1 = p1;
            _p2 = p2;

            Objects.Add(_p1);
            Objects.Add(_p2);

            Name = "Отрезок";
        }
Ejemplo n.º 3
0
        public void OnMouseClick(GrPanel panel, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
                return;

            GrPoint pnt = new GrPoint(
                null,
                e.X,
                e.Y
                );

            panel.Edited.Objects.Add(pnt);
            panel.Invalidate();
        }
Ejemplo n.º 4
0
        public void OnMouseClick(GrPanel panel, System.Windows.Forms.MouseEventArgs e)
        {
            IGrObj grobj = panel.GetObjectUnder(e.X, e.Y);

            IGrObj parent = grobj;
            if (grobj == null || grobj.IsPrimitive)
            {
                parent = panel.Root;
            }

            if (_linePnt == null)
            {
                if (grobj is GrPoint)
                {
                    _linePnt = grobj as GrPoint;
                }
                else
                {
                    _linePnt = new GrPoint(parent, e.X, e.Y);
                }
            }
            else if (parent == _linePnt.Parent)
            {
                GrLine line;
                if (grobj is GrPoint)
                {
                    line = new GrLine(null, _linePnt, grobj as GrPoint);
                }
                else
                {
                    line = new GrLine(null, _linePnt, new GrPoint(null, e.X, e.Y));
                }

                line.Color = panel.SpawnColor;
                panel.Edited.Objects.Add(line);
                _linePnt = null;
                panel.Invalidate();
            }
        }
Ejemplo n.º 5
0
 public void Deactivate(GrPanel panel)
 {
     _linePnt = null;
 }