Beispiel #1
0
        const string RegexSpecSymbolsPattern = @"[\^\$\[\]\(\)\.\\\*\+\|\?\{\}]"; //static-->const: 2015.07.05.
        public ChatPanel()
        {
            InitializeComponent();
            //Amint létrehozom, ez a kód lefut - Nem számit, hogy megjelenik-e

            this.Text    = Language.Translate(Language.StringID.Chat_Title, this);
            button1.Text = Language.Translate(Language.StringID.Handwriting, button1); //2015.06.29.

            style       = new TextBoxHelpers.GifImageStyle(messageTextBox);
            styleRecent = new TextBoxHelpers.GifImageStyle(recentMsgTextBox); //2015.06.16.
            foreach (var item in TextFormat.TextFormats)
            {                                                                 //2015.06.26.
                foreach (var item2 in item.Emoticons)
                {
                    style.ImagesByText.Add(item2.Value, item2.Image);
                    styleRecent.ImagesByText.Add(item2.Value, item2.Image);
                }
            }
            style.StartAnimation();           //2015.06.16.
            styleRecent.StartAnimation();     //2015.06.16.

            messageTextBox.OnTextChanged();   //2015.06.16.
            recentMsgTextBox.OnTextChanged(); //2015.06.16.
            recentMsgTextBox.GoEnd();         //2015.06.16.
        } //TODO: A recentMsgTextBox-nál megoldani az OpenLink event-et
Beispiel #2
0
        public void CreateListItem(RichListView listView, int pos)
        {
            string state = "";

            if (this.State == 1)
            {
                state = " (" + Language.Translate(Language.StringID.Menu_File_Status_Online) + ")";
            }
            else if (this.State == 2)
            {
                state = " (" + Language.Translate(Language.StringID.Menu_File_Status_Busy) + ")";
            }
            else if (this.State == 3)
            {
                state = " (" + Language.Translate(Language.StringID.Menu_File_Status_Away) + ")";
            }
            else
            {
                state = " (" + Language.Translate(Language.StringID.Offline) + ")";
            }
            string text = this.Name + state + "\n" + this.Message;

            TMPListID = pos;

            bool tmp = listView.AutoUpdate;

            listView.AutoUpdate = false;
            listView.SuspendLayout();                 //2014.12.21.
            while (listView.Items.Count <= TMPListID) //Azt is adja hozzá, ami a kész listaelem lesz
            {
                var pictb = new PictureBox();
                pictb.SizeMode = PictureBoxSizeMode.Zoom;
                pictb.Image    = Image;                                 //2015.05.30.
                var listtext = new FastColoredTextBox();                //2015.07.05.
                listtext.ShowLineNumbers = false;                       //2015.07.05.
                var style = new TextBoxHelpers.GifImageStyle(listtext); //2015.07.05.
                foreach (var item in TextFormat.TextFormats)
                {                                                       //2015.07.05.
                    foreach (var item2 in item.Emoticons)
                    {
                        style.ImagesByText.Add(item2.Value, item2.Image);
                    }
                }
                listtext.Text         = text; //2015.07.05.
                listtext.TextChanged += delegate(object sender, TextChangedEventArgs e)
                {
                    if (style == null)
                    {
                        return;
                    }
                    e.ChangedRange.ClearStyle(StyleIndex.All);
                    foreach (var key in style.ImagesByText.Keys)
                    {
                        string pattern = Regex.Replace(key, RegexSpecSymbolsPattern, "\\$0");
                        e.ChangedRange.SetStyle(style, pattern);
                    }
                };
                style.StartAnimation();                                                       //2015.07.05.
                listtext.OnTextChanged();                                                     //2015.07.05.
                listView.Items.Add(new RichListViewItem(new Control[] { pictb, listtext }));  //2015.07.05.
            }
            if (Image == null)                                                                //2015.05.30.
            {
                ((PictureBox)listView.Items[TMPListID].SubItems[0]).Image = UserInfo.NoImage; //2015.05.30.
            }
            else
            {
                ((PictureBox)listView.Items[TMPListID].SubItems[0]).Image = Image; //2015.05.30.
            }
            listView.Items[TMPListID].SubItems[1].Text = text;
            listView.AutoUpdate = tmp;
            listView.ResumeLayout(true); //2014.12.21.
        }