コード例 #1
0
ファイル: SearchForm.cs プロジェクト: VladimirKhil/CIRCe
 /// <summary>
 /// Подсветить результат поиска
 /// </summary>
 /// <param name="start">Начало подсветки (длина определяется длиной поискового запроса)</param>
 private void Highlight(int start)
 {
     if (start > -1)
     {
         if (saver.Left > -1)
             saver.Paste();
         saver.CopyFrom(this.richTextBox, start, start + this.tbSearch.Text.Length);
         this.richTextBox.SelectionBackColor = Color.Lavender;
         richTextBox.ScrollToCaret();
     }
 }
コード例 #2
0
        private void chatRTB_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                return;
            }

            int  left = 0, right = 0;
            bool b = GetToken(chatRTB, e.Location, out left, out right, IsNickChar, IsNick);

            if (nickSaver.Left != -1 && (!b || left + 1 != nickSaver.Left))
            {
                chatRTB.SelectionStart  = nickSaver.Left;
                chatRTB.SelectionLength = nickSaver.Right - nickSaver.Left;

                nickSaver.Paste();
                chatRTB.SelectionLength = nickSaver.Right - nickSaver.Left;
                chatRTB.SelectionStart  = nickSaver.Left;
                chatRTB.SelectedText    = chatRTB.SelectedText.Replace(' ', '\u00A0');
                chatRTB.SelectionLength = 0;

                nickSaver.Left = -1;
            }

            if (b && (nickSaver.Left == -1 || nickSaver.Left != left + 1))
            {
                string name = chatRTB.Text.Substring(left + 1, right - left - 1);
                if (HasPerson(name))
                {
                    HighLight(chatRTB, left + 1, right, nickSaver);
                }
            }
        }
コード例 #3
0
        private void chatRTB_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                return;
            }
            int  left = 0, right = 0;
            bool b = GetToken(chatRTB, e.Location, out left, out right, IsChannelChar, IsChannel);

            if (saver.Left != -1 && (!b || left != saver.Left))
            {
                chatRTB.SelectionStart  = saver.Left;
                chatRTB.SelectionLength = saver.Right - saver.Left;

                saver.Paste();
                chatRTB.SelectionLength = 0;

                saver.Left = -1;
            }

            if (b && (saver.Left == -1 || saver.Left != left))
            {
                HighLight(chatRTB, left, right, saver);
            }
        }