Ejemplo n.º 1
0
        /// <summary>
        /// Selects last shape containing point(x,y)
        /// </summary>
        /// <param name="x">X region on coordinate system</param>
        /// <param name="y">Y region on coordinate system</param>
        public void Click(int x, int y)
        {
            handlerCol      = null;
            selectedElement = null;

            foreach (ShapeElement element in this.shapes)
            {
                element.Selected = false;
                element.DeSelect();

                if (element.Contains(x, y))
                {
                    selectedElement = element;
                }
            }
            if (selectedElement != null)
            {
                selectedElement.Selected = true;
                selectedElement.Select();

                if (selectedElement is Polygon)
                {
                    handlerCol = new PolygonHandlerCollection(selectedElement);
                }
                else
                {
                    handlerCol = new ShapeHandlerCollection(selectedElement);
                }
            }
        }