Esempio n. 1
0
 public Shape GetShapeAt(int x, int y)
 {
     foreach (Shape SelectedShape in ShapesDrawn)
     {
         if (SelectedShape.Intersect(x, y))
         {
             return(SelectedShape);
         }
     }
     return(null);
 }
Esempio n. 2
0
        public override bool Intersect(int xTest, int yTest)
        {
            bool IntersectShape = false;

            foreach (Shape SelectedShape in GroupShape)
            {
                if (SelectedShape.Intersect(xTest, yTest))
                {
                    IntersectShape = true;
                    break;
                }
            }

            return(IntersectShape);
        }
Esempio n. 3
0
        public void ToolMouseDown(object Sender, MouseEventArgs Event)
        {
            XPoint = Event.X;
            YPoint = Event.Y;

            if (Event.Button == MouseButtons.Left)
            {
                this.SelectionArea = new Selection(Event.X, Event.Y);
                this.ActiveCanvas.AddDrawnShape(this.SelectionArea);
            }
            else if (Event.Button == MouseButtons.Right)
            {
                bool IntersectShape = false;
                if (SelectedShapes != null)
                {
                    foreach (Shape SelectedShape in SelectedShapes)
                    {
                        if (SelectedShape.Intersect(Event.X, Event.Y))
                        {
                            IntersectShape = true;
                            break;
                        }
                    }
                }

                if (!IntersectShape)
                {
                    SelectedShapes = new List <Shape>();
                    ActiveCanvas.DeselectAllShapes();
                    Shape SelectedShape = ActiveCanvas.GetShapeAt(Event.X, Event.Y);
                    if (SelectedShape != null)
                    {
                        SelectedShape.Select();
                        SelectedShapes.Add(SelectedShape);
                        IntersectShape = true;
                    }
                }

                if (IntersectShape)
                {
                    this.MovementTrace = new MovementLine(new System.Drawing.Point(Event.X, Event.Y))
                    {
                        Endpoint = new System.Drawing.Point(Event.X, Event.Y)
                    };
                    ActiveCanvas.AddDrawnShape(this.MovementTrace);
                }
            }
        }