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(); } }
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 = "Отрезок"; }
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(); }
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(); } }
public void Deactivate(GrPanel panel) { _linePnt = null; }