Пример #1
0
        /// <summary>
        /// Get the element at the specified point. Usually this methods simply return the current element, but an element can return inner elements drawed inside the main elements.
        /// Returns a list of elements, where the last element is the upper (foremost) element and the first element is the background element.
        /// </summary>
        /// <param name="measure"></param>
        /// <param name="area"></param>
        /// <param name="point"></param>
        /// <returns></returns>
        public override VisualElementList GetElementsAtPoint(MeasureHelper measure, System.Drawing.RectangleF area, PointF point)
        {
            VisualElementList list = base.GetElementsAtPoint(measure, area, point);

            area = GetContentRectangle(measure, area);

            //Use the same code of the OnDrawContent method
            //In this case the elements are drawed one over the another
            if (ElementsDrawMode == ElementsDrawMode.Covering)
            {
                foreach (IVisualElement element in GetElements())
                {
                    list.AddRange(element.GetElementsAtPoint(measure, area, point));
                }
            }
            //In this case the elements are drawed considering an alignment
            else if (ElementsDrawMode == ElementsDrawMode.Align)
            {
                foreach (IVisualElement element in GetElements())
                {
                    list.AddRange(element.GetElementsAtPoint(measure, area, point));

                    RectangleF elementArea = element.GetDrawingArea(measure, area);
                    area = CalculateRemainingArea(area, element.AnchorArea, elementArea);
                }
            }
            else
            {
                throw new ApplicationException("DrawMode not supported");
            }

            return(list);
        }
Пример #2
0
        /// <summary>
        /// Get the element at the specified point. Usually this methods simply return the current element, but an element can return inner elements drawed inside the main elements.
        /// Returns a list of elements, where the last element is the upper element and the first element is the background element.
        /// </summary>
        /// <param name="measure"></param>
        /// <param name="area"></param>
        /// <param name="point"></param>
        /// <returns></returns>
        public virtual VisualElementList GetElementsAtPoint(MeasureHelper measure, System.Drawing.RectangleF area, PointF point)
        {
            VisualElementList list = new VisualElementList();

            if (GetDrawingArea(measure, area).Contains(point))
            {
                list.Add(this);
            }

            return(list);
        }
Пример #3
0
        public object Clone()
        {
            VisualElementList elements = new VisualElementList();

            foreach (IVisualElement element in this)
            {
                elements.Add((IVisualElement)element.Clone());
            }

            return(elements);
        }