public EcciotListRefreshManager() { timer.Interval = 1; timer.Tick += delegate { if (Items.Count == 0) { timer.Enabled = false; return; } //执行列表中所有项的刷新方法 for (int i = 0; i < Items.Count; i++) { EcciotListItem item = Items[i]; if (item.RefreshItemSize()) { Items.RemoveAt(i); i--; if (Items.Count == 0) { timer.Enabled = false; break; } } } }; timer.Enabled = true; }
public void AddItem(EcciotListItem item) { //扩大表格容量并加入EcciotListItem对象 this.tlp.RowCount += 1; this.tlp.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tlp.Controls.Add(item, 0, this.tlp.RowCount - 1); //设置EcciotListItem的属性 item.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; item.Dock = System.Windows.Forms.DockStyle.Fill; item.UseSelectable = true; //添加EcciotListRefreshManager if (!RefreshManager.Items.Contains(item)) { item.RefreshManager = this.refreshManager; } }