Пример #1
0
        public void PrintDate(string text)
        {
            if (this.rtb.InvokeRequired)
            {
                this.rtb.BeginInvoke((MethodInvoker) delegate { PrintDate(text); });
            }
            else
            {
                if (text == null)
                {
                    return;
                }

                rtb.Select(rtb.TextLength, 0);

                rtb.SelectionColor = Color.DarkGray;
                ////rtb.SelectionCharOffset = 6;
                rtb.SelectionFont       = new Font(rtb.SelectionFont.Name, textfontsize - 1, rtb.SelectionFont.Style);
                rtb.SelectionCharOffset = 0;// 10;
                AppendNStext(text);

                //rtb.AppendTextAsRtf(text, new Font(rtb.SelectionFont.Name, textfontsize - 2), RtfColor.Gray, RtfColor.White);
                rtb.SelectionFont = new Font(config.CurrentConfig.TextFont, config.CurrentConfig.TextFontSize, fontst);
                //rtb.SelectionFont = new Font(textfont, textfontsize, fontst);
                //rtb.SelectionColor = Color.Black;
                rtb.SelectionCharOffset = 0;
                //rtb.SelectionBackColor = rtb.BackColor = bgcolour;
            }
        }
Пример #2
0
 void AddEmotions(ExRichTextBox richTextBox)
 {
     foreach (string emote in _emotions.Keys)
     {
         while (richTextBox.Text.Contains(emote))
         {
             int ind = richTextBox.Text.IndexOf(emote, StringComparison.Ordinal);
             richTextBox.Select(ind, emote.Length);
             richTextBox.InsertImage((Image)_emotions[emote]);
         }
     }
 }
Пример #3
0
 private void AddEmotionsImages(string text)
 {
     //For Happy Smiley
     if (text.Contains(":)"))
     {
         int _index;
         while ((_index = rtbChat.Find(":)")) > -1)
         {
             rtbChat.Select(_index, ":)".Length);
             rtbChat.InsertImage(Image.FromFile(App.Model.Ap.FolderImages + @"smiley\" + "Happy.png"));
         }
     }
     //For Wink Smiley
     if (text.Contains(";)"))
     {
         int _index;
         while ((_index = rtbChat.Find(";)")) > -1)
         {
             rtbChat.Select(_index, ";)".Length);
             rtbChat.InsertImage(Image.FromFile(App.Model.Ap.FolderImages + @"smiley\" + "Wink.png"));
         }
     }
     //For Sad Smiley
     if (text.Contains(":("))
     {
         int _index;
         while ((_index = rtbChat.Find(":(")) > -1)
         {
             rtbChat.Select(_index, ":(".Length);
             rtbChat.InsertImage(Image.FromFile(App.Model.Ap.FolderImages + @"smiley\" + "Sad.png"));
         }
     }
     //For Angry Smiley
     if (text.Contains(":@"))
     {
         int _index;
         while ((_index = rtbChat.Find(":@")) > -1)
         {
             rtbChat.Select(_index, ":@".Length);
             rtbChat.InsertImage(Image.FromFile(App.Model.Ap.FolderImages + @"smiley\" + "Angry.png"));
         }
     }
     //For Surprised Smiley
     if (text.Contains(":-O") || text.Contains(":-o"))
     {
         int _index;
         while ((_index = rtbChat.Find(":-O")) > -1)
         {
             rtbChat.Select(_index, ":-O".Length);
             rtbChat.InsertImage(Image.FromFile(App.Model.Ap.FolderImages + @"smiley\" + "Suprised.png"));
         }
     }
     //For Kiss Smiley
     if (text.Contains("(K)") || text.Contains("(k)"))
     {
         int _index;
         while ((_index = rtbChat.Find("(K)")) > -1)
         {
             rtbChat.Select(_index, "(K)".Length);
             rtbChat.InsertImage(Image.FromFile(App.Model.Ap.FolderImages + @"smiley\" + "Kiss.png"));
         }
     }
     //For Question Smiley
     if (text.Contains(":?"))
     {
         int _index;
         while ((_index = rtbChat.Find(":?")) > -1)
         {
             rtbChat.Select(_index, ":?".Length);
             rtbChat.InsertImage(Image.FromFile(App.Model.Ap.FolderImages + @"smiley\" + "Question.png"));
         }
     }
     //For Laughing Smiley
     if (text.Contains(":D") || text.Contains(":d"))
     {
         int _index;
         while ((_index = rtbChat.Find(":D")) > -1)
         {
             rtbChat.Select(_index, ":D".Length);
             rtbChat.InsertImage(Image.FromFile(App.Model.Ap.FolderImages + @"smiley\" + "Laughing.png"));
         }
     }
     //For Sleep Smiley
     if (text.Contains(":-)"))
     {
         int _index;
         while ((_index = rtbChat.Find(":-)")) > -1)
         {
             rtbChat.Select(_index, ":-)".Length);
             rtbChat.InsertImage(Image.FromFile(App.Model.Ap.FolderImages + @"smiley\" + "Sleep.png"));
         }
     }
     //For Unfair Smiley
     if (text.Contains(":|"))
     {
         int _index;
         while ((_index = rtbChat.Find(":|")) > -1)
         {
             rtbChat.Select(_index, ":|".Length);
             rtbChat.InsertImage(Image.FromFile(App.Model.Ap.FolderImages + @"smiley\" + "Unfair.png"));
         }
     }
 }