Пример #1
0
        /// <summary>
        /// return the location on the text line of the specified coordinate point within
        /// the RichTextBox.
        /// </summary>
        /// <param name="TextBox"></param>
        /// <param name="Point"></param>
        /// <returns></returns>
        public static Tuple <TextPointer, int, int> GetLocationFromPoint(
            this RichTextBox TextBox, Point Point)
        {
            TextPointer tp = TextBox.GetPositionFromPoint(Point, true);

            var px = tp.GetPositionInLine();

            if (px > 0)
            {
                px = px - 1;
            }

            var lineBx = tp.GetLineNumber(TextBox.Document);

            return(new Tuple <TextPointer, int, int>(tp, lineBx, px));
        }