示例#1
0
        public void SelectLink(string strText, string strLink)
        {
            string strLinkRTF = @"{\rtf1\ansi " + strText + @"\v #" + strLink + @"\v0}";
            int    nPos       = Rtf.IndexOf(strText);
            int    nSelStart  = SelectionStart;
            int    nSelLength = SelectionLength;

            while (nPos >= 0)
            {
                SelectionStart  = nPos;
                SelectionLength = strText.Length;
                if (SelectedRtf == strLinkRTF)
                {
                    return;
                }

                nPos = Text.IndexOf(strText, nPos + strText.Length);
            }
            SelectionStart  = nSelStart;
            SelectionLength = nSelLength;
        }