Ejemplo n.º 1
0
        public void DealwithReceive(string str)
        {
            TextBox_ChatHistory.AppendText(str + Environment.NewLine);
            int length = str.IndexOf(Environment.NewLine) + 1;

            if (length > 0)
            {
                TextBox_ChatHistory.Select(TextBox_ChatHistory.Text.Length - str.Length + 1, length);
                TextBox_ChatHistory.SelectionBrush = Brushes.Blue;
            }
            ScrollToDown();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 新增聊天的历史记录
        /// </summary>
        /// <param name="str"></param>
        public void AddChatsHistory(string str)
        {
            TextBox_ChatHistory.Text = str;
            MatchCollection mc       = Regex.Matches(str, @"\u0002.+\r\n");
            int             indexrow = 0;

            if (str != "")
            {
                foreach (Match m in mc)
                {
                    TextBox_ChatHistory.Select(m.Index - indexrow * 2, m.Length - 2);
                    TextBox_ChatHistory.SelectionBrush = Brushes.Blue;
                    indexrow++;
                }
            }
            ScrollToDown();
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 光标滚动到最底端
 /// </summary>
 public void ScrollToDown()
 {
     TextBox_ChatHistory.ScrollToEnd();
 }