Ejemplo n.º 1
0
        void MoveHighlight(RichTextBoxHighlight highlight, TextPointer startPoint, int length)
        {
            //find the Run
            Run run = null;

            //if (startPoint.Paragraph != null)
            run = GetRun(startPoint, startPoint.Paragraph);
            //else if(startPoint.Parent
            //   run = GetRun(startPoint, startPoint.Parent);

            if (run != null)
            {
                int start = run.ContentStart.GetOffsetToPosition(startPoint);
                highlight.MoveTo(run, start, start + length, adapter.GetIndexOfPointer(run.ContentStart));
            }
            else
            {
                //we seem to have lost the adorner but still tracking the highlight, so lose it too
                RemoveHighlight(highlight);
            }
        }