Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public partial class NotificationCenterWindow : UserControl
- {
- int x = 5;
- int y = 10;
- char[] arr;
- public NotificationCenterWindow()
- {
- InitializeComponent();
- }
- public void messages(List<string> list_msg) // создание панелей для сообщений.
- {
- for (int i = 0; i < list_msg.Count; i++)
- {
- Panel panel = new Panel();
- panel.Name = "pan"+i.ToString();
- TextBox textBox1 = new TextBox();
- TextBox textBox2 = new TextBox();
- TextBox textBox3 = new TextBox();
- panel.Width = 308;
- panel.BackColor = Color.Bisque;
- panel.Location = new Point(x, y);
- panel.Controls.Add(textBox1);
- textBox1.Size = new System.Drawing.Size(90, 10);
- textBox1.Location = new Point(10, 10);
- textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
- textBox1.BackColor = Color.Bisque;
- panel.Controls.Add(textBox2);
- textBox2.Location = new Point(200, 10);
- textBox2.BorderStyle = System.Windows.Forms.BorderStyle.None;
- textBox2.BackColor = Color.Bisque;
- textBox2.TextAlign = HorizontalAlignment.Right;
- textBox2.Anchor = AnchorStyles.Right;
- panel.Controls.Add(textBox3);
- textBox3.Location = new Point(10, 30);
- textBox3.BorderStyle = System.Windows.Forms.BorderStyle.None;
- textBox3.BackColor = Color.Bisque;
- textBox3.MaximumSize = new System.Drawing.Size(292, 100);
- textBox3.Size = new System.Drawing.Size(292, 60);
- textBox3.Multiline = true;
- textBox3.Anchor = AnchorStyles.Right | AnchorStyles.Left;
- Button delButt = new Button();
- delButt.Size = new System.Drawing.Size(12, 12);
- delButt.Location = new Point(292, 2);
- delButt.Anchor = AnchorStyles.Right;
- Bitmap bmp = new Bitmap(Properties.Resources.close);
- delButt.BackgroundImage = bmp;
- panel.MouseHover += (sender, e) =>
- {
- textBox2.Hide();
- panel.Controls.Add(delButt);
- delButt.Show();
- };
- panel.MouseLeave += (sender, e) =>
- {
- textBox2.Show();
- };
- panel1.Controls.Add(panel);
- panel.Anchor = AnchorStyles.Left | AnchorStyles.Right;
- y += 120;
- string[] out_info = list_msg[i].Split('|');
- textBox1.Text = out_info[1];
- textBox2.Text = out_info[2];
- arr = out_info[3].ToCharArray(); // если в сообщении больше 120 символов - обрезаем и добавляем "..."
- for (int j = 0; j < 120; j++) {
- textBox3.Text += arr[j].ToString();
- }
- if (arr.Length > 120) {
- textBox3.Text += "...";
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement