public static void AddMessage(this FlowLayoutPanel source, MessageTypeEnum messageType, string message) { var panel = new FlowLayoutPanel(); panel.AutoSize = true; panel.WrapContents = false; panel.FlowDirection = FlowDirection.TopDown; var lbl = new Label(); lbl.AutoSize = true; lbl.Margin = new Padding(10, 10, 10, 0); lbl.Text = messageType.ToString(); lbl.ForeColor = Color.FromName("White"); lbl.BackColor = messageType.ToColor(); lbl.BorderStyle = BorderStyle.FixedSingle; lbl.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Bold); panel.Controls.Add(lbl); var lbl2 = new Label(); lbl2.AutoSize = true; lbl2.Margin = new Padding(10, 5, 10, 5); lbl2.Text = message; lbl2.Font = new Font("Microsoft Sans Serif", 10f); panel.Controls.Add(lbl2); source.Controls.Add(panel); Application.DoEvents(); source.Focus(); }