private void ShowControlsIndex(UcBill ucBill, bool hebing) { if (hebing) { //展开 int billIndex = this.flowLayoutPanel1.Controls.IndexOf(ucBill); int viewIndex = this.flowLayoutPanel1.Controls.IndexOf(this.listView1); if (lastControlIndex != -1) { ((UcBill)this.flowLayoutPanel1.Controls[lastControlIndex]).SetHeFlag(false); } if (viewIndex < billIndex) { this.flowLayoutPanel1.Controls.SetChildIndex(this.listView1, billIndex); } else { this.flowLayoutPanel1.Controls.SetChildIndex(this.listView1, billIndex + 1); } lastControlIndex = this.flowLayoutPanel1.Controls.IndexOf(ucBill); ShowBillDetail(ucBill.billModel.BillID); } else { //展开 this.listView1.Visible = false; } }
/// <summary> /// 显示借款列表 /// </summary> private void ShowBillInfo() { foreach (Control item in this.flowLayoutPanel1.Controls) { if (item.Tag == null) { flowLayoutPanel1.Controls.Remove(item); } } this.listView1.Visible = false; List <Model.BillModel> list = DAL.BillDAL.GetBillList("deleted=0 and flag=0 order by beginday"); Action <UcBill, bool> action = new Action <UcBill, bool>(ShowControlsIndex); for (int i = 0; i < list.Count; i++) { UcBill ucbill = new UcBill(list[i], action, i + 1); this.flowLayoutPanel1.Controls.Add(ucbill); } }