//bool quote = false; private void cntrlMessDialog_Load(object sender, EventArgs e) { if (!String.IsNullOrEmpty(this.mess.from.fname) || !String.IsNullOrEmpty(this.mess.from.sname)) { lblAutor.Text = this.mess.from.fname + " " + this.mess.from.sname; } else { lblAutor.Text = this.mess.from.login; } lblTime.Text = this.mess.post_time.ToLongDateString() + " " + this.mess.post_time.ToShortTimeString(); label1.Text = message_lbl; richTextBox1.Text = message_rtb; #region цитата if (richTextBox1.Text.Contains("|blockquote|") && richTextBox1.Text.Contains("|/blockquote|")) { System.Drawing.Font currentFont = richTextBox1.Font; System.Drawing.FontStyle newFontStyle = FontStyle.Italic; //string[] lines = richTextBox1.Text.Split("\n"); while (richTextBox1.Text.Contains("|blockquote|") && richTextBox1.Text.Contains("|/blockquote|")) { try { int a, b = 0; if (richTextBox1.Text.TrimStart().StartsWith("|blockquote|")) { a = richTextBox1.Text.IndexOf("|blockquote|") - 3; b = richTextBox1.Text.IndexOf("|/blockquote|") - richTextBox1.Text.IndexOf("|blockquote|") - 9; } else { a = richTextBox1.Text.IndexOf("|blockquote|"); b = richTextBox1.Text.IndexOf("|/blockquote|") - richTextBox1.Text.IndexOf("|blockquote|") - 12; } richTextBox1.Text = richTextBox1.Text.Replace("|blockquote|", "").Replace("|/blockquote|", ""); richTextBox1.Select(a, b); richTextBox1.SelectionFont = new Font(currentFont.FontFamily, currentFont.Size, newFontStyle); richTextBox1.SelectionBackColor = Color.GhostWhite; richTextBox1.DeselectAll(); } catch (Exception)//exquote { //MessageBox.Show("цитата \n-\n" + exquote.Message + "\n-\n" + exquote.Source + "\n-\n" + exquote.InnerException); continue; } } } #endregion #region Login if (clsUpdate.fromLogin != this.mess.from.login) { pnlAvatar.Dock = DockStyle.Right; //lblAutor.Dock = DockStyle.Right; //lblTime.Dock = DockStyle.Left; } #endregion #region приложения if (mess.url_Attachments != null && mess.url_Attachments.Count > 0) { for (int v = 0; v < mess.url_Attachments.Count(); v++) { try { string s = mess.url_Attachments[v]; cntrlTagtext cntrlTagtext = new cntrlTagtext(s); cntrlTagtext.Parent = (Control)this.pnlAttach; cntrlTagtext.Dock = DockStyle.Right; } catch (Exception) //exAp { //MessageBox.Show("приложения \n-\n" + exAp.Message + "\n-\n" + exAp.Source + "\n-\n" + exAp.InnerException); continue; } } } else { //pnlAttach.AutoSize = true; //pnlAttach.BackColor = Color.BurlyWood; //pnlAttach.Visible = false; } #endregion }