コード例 #1
0
        /// <summary>
        /// Gets the character index of a Point
        /// </summary>
        public int GetCharIndexFromPos(System.Windows.Point pos)
        {
            TextPointer p = txc.GetPositionFromPoint(pos, true);

            if (p != null)
            {
                return(ConvertSymbolOffsetToPlain(txc.Document.ContentStart.GetOffsetToPosition(p)));
            }
            else
            {
                return(-1);
            }
        }