コード例 #1
0
        /// <summary>
        /// Retrieves the range of a child object.
        /// </summary>
        /// <param name="childElement">The child element.  If the element is not
        /// a child of the text container then an InvalidOperation exception is
        /// thrown.</param>
        /// <returns>A range that spans the child element.</returns>
        public TextPatternRange RangeFromChild(AutomationElement childElement)
        {
            if (childElement == null)
            {
                throw new ArgumentNullException("childElement");
            }
            SafeTextRangeHandle hTextRange = UiaCoreApi.TextPattern_RangeFromChild(_hPattern, childElement.RawNode);

            return(TextPatternRange.Wrap(hTextRange, this));
        }