/// <summary>
        /// Get the rectangle of html element as calculated by html layout.<br/>
        /// Element if found by id (id attribute on the html element).<br/>
        /// Note: to get the screen rectangle you need to adjust by the hosting control.<br/>
        /// </summary>
        /// <param name="elementId">the id of the element to get its rectangle</param>
        /// <returns>the rectangle of the element or null if not found</returns>
        public RRect?GetElementRectangle(string elementId)
        {
            ArgChecker.AssertArgNotNullOrEmpty(elementId, "elementId");

            var box = DomUtils.GetBoxById(this._root, elementId.ToLower());

            return(box != null?CommonUtils.GetFirstValueOrDefault(box.Rectangles, box.Bounds) : (RRect?)null);
        }
        /// <summary>
        /// Get the rectangle of html element as calculated by html layout.<br/>
        /// Element if found by id (id attribute on the html element).<br/>
        /// Note: to get the screen rectangle you need to adjust by the hosting control.<br/>
        /// </summary>
        /// <param name="elementId">the id of the element to get its rectangle</param>
        /// <returns>the rectangle of the element or null if not found</returns>
        public RRect?GetElementRectangle(string elementId, out List <string> elementsIds, out CssBox box)
        {
            elementsIds = new List <string>();
            ArgChecker.AssertArgNotNullOrEmpty(elementId, "elementId");

            box = DomUtils.GetBoxById(_root, elementId.ToLower(), ref elementsIds);

            return(box != null?CommonUtils.GetFirstValueOrDefault(box.Rectangles, box.Bounds) : (RRect?)null);
        }
Example #3
0
        /// <summary>
        /// Find an element by element id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public DOMElement getElementById(string id)
        {
            CssBox element = DomUtils.GetBoxById(_root, id);

            if (element == null)
            {
                return(null);
            }
            else
            {
                return(new DOMElement(element));
            }
        }