private void btnAdd_Click(object sender, EventArgs e) { DataRow row = dt.NewRow(); row[0] = "新" + count; dt.Rows.Add(row); PanelItem item = new PanelItem(); item.DataRow = row; item.Height = this.panelEx1.MinRowHeight; this.panelEx1.Add(item); count++; }
void panelEx1_SelectionChanged(PanelItem item) { richTextBox1.AppendText("SelectionChanged \n"); richTextBox1.ScrollToCaret(); }
MyPanelChild panelEx1_SetItemTemplate(PanelItem item) { int height = this.panelEx1.MinRowHeight; if (!cbxEqualHeight.Checked) { height += heightOffset; heightOffset++; } WorkBench pnl = new WorkBench(); pnl.Height = height; pnl.DataRow = item.DataRow; pnl.RowIndex = item.RowIndex; pnl.RefreshData(); pnl.SizeChanged +=pnl_SizeChanged; return pnl; }
/// <summary> /// 添加行数据 /// </summary> /// <param name="item"></param> private void AddItem(PanelItem item) { if (SetItemTemplate == null) throw new Exception("必须启用 SetItemTemplate 事件"); //MyPanelChild childItem = SetItemTemplate(item, myVScrollBar1.Value); //item.Height = childItem.Height; //displayRectangleHeight += item.Height; //itemList.Add(item); //if (controlList.Count < maxControlCount) //{ // AddControl(childItem); //} item.Height = this.minRowHeight; displayRectangleHeight += item.Height; itemList.Add(item); if (controlList.Count < maxControlCount) { MyPanelChild childItem = SetItemTemplate(item); AddControl(childItem); } }
public void Add(PanelItem item) { item.RowIndex = itemList.Count; item.IsSelected = true; AddItem(item); this.UpdateScrollbar(); this.ScrollToCaret(); this.Refresh(item.RowIndex); }
/// <summary> /// 添加行数据 /// </summary> /// <param name="item"></param> private void AddItem(PanelItem item) { if (SetItemTemplate == null) throw new Exception("必须启用 SetItemTemplate 事件"); MyPanelChild childItem = SetItemTemplate(item); item.Height = childItem.Height; displayRectangleHeight += item.Height; itemList.Add(item); if (controlList.Count < maxControlCount) { AddControl(childItem); } }
MyPanelChild panelEx1_UpdateChildItem(PanelItem item) { DateTime startTime = DateTime.Now; MyPanelChild control = null; if (item.PanelChild == null) { control = panelEx1_SetItemTemplate(item); item.PanelChild = control; } else { control = item.PanelChild; //control.RefreshData(); } richTextBox1.AppendText((DateTime.Now - startTime).TotalMilliseconds + " TTTTTTTTTT \n"); richTextBox1.ScrollToCaret(); return control; }
MyPanelChild panelEx1_SetItemTemplate(PanelItem item) { WorkBench pnl = new WorkBench(); pnl.DataRow = item.DataRow; pnl.RowIndex = item.RowIndex; pnl.RefreshData(); return pnl; }