public void showLog(object state) { LogMode logMode = (LogMode)state; EventItem item = new EventItem(logMode.content, logMode.img); this.flowLayoutPanel1.Controls.Add(item); this.flowLayoutPanel1.Controls.SetChildIndex(item, 0); if (this.flowLayoutPanel1.Controls.Count > maxLog) { this.flowLayoutPanel1.Controls[this.flowLayoutPanel1.Controls.Count - 1].Dispose(); } this.flowLayoutPanel1.VerticalScroll.Value = 0; this.flowLayoutPanel1.VerticalScroll.Value = 0; this.flowLayoutPanel1.Refresh(); }