/// <summary> /// 选择部门 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDep_Press(object sender, EventArgs e) { try { popDep.Groups.Clear(); PopListGroup depGroup = new PopListGroup { Title = "部门" }; var deplist = _autofacConfig.DepartmentService.GetAllDepartment(); foreach (var dep in deplist) { PopListItem item = new PopListItem { Value = dep.DEPARTMENTID, Text = dep.NAME }; depGroup.Items.Add(item); } popDep.Groups.Add(depGroup); if (!string.IsNullOrEmpty(DepId)) { foreach (PopListItem row in popDep.Groups[0].Items) { if (row.Value == DepId) { popDep.SetSelections(row); } } } popDep.ShowDialog(); } catch (Exception ex) { Toast(ex.Message); } }
private void popList1_Selected(object sender, EventArgs e) { switch (popList1.Selections[0].Text) { case "Groups": PopListGroup g1 = new PopListGroup(); g1.TitleVisible = true; g1.Title = "审批人"; for (int i = 1; i < 3; i++) { g1.AddListItem(i.ToString()); } PopListGroup g2 = new PopListGroup(); g2.Title = "抄送人"; g2.TitleVisible = true; for (int i = 1; i < 3; i++) { g2.AddListItem(i.ToString()); } PopListItem popItem = new PopListItem(); popItem.Value = "USER_ID"; popItem.Text = "USER_ID"; g2.Items.Add(popItem); this.popList2.Groups.Add(g1); this.popList2.Groups.Add(g2); labContent.Text = "选择组集合数据添加"; break; case "Show": this.popList2.MultiSelect = false; this.popList2.SingleSelectMode = true; this.popList2.Show(); labContent.Text = "显示列表选择界面"; break; case "ShowDialog": this.popList2.MultiSelect = false; this.popList2.ShowDialog(); labContent.Text = "显示对话框列表选择界面"; break; case "Multi-Show": this.popList2.MultiSelect = true; this.popList2.Show(); labContent.Text = "设置多选来显示列表选择界面"; break; case "Multi-ShowDialog": this.popList2.MultiSelect = true; this.popList2.ShowDialog(); labContent.Text = "设置多选来显示对话框列表选择界面"; break; case "SingleSelectMode": this.popList2.MultiSelect = false; this.popList2.SingleSelectMode = false; this.popList2.Show(); labContent.Text = "单选时可设置2种不同的选择模式,true时点击结束选择,false时点击完成按钮确认选择"; break; case "Selected事件": labContent.Text = "Selected事件在Poplist选择完成时发生。"; break; } }
//状态 private void txtStatus_TextChanged(object sender, EventArgs e) { try { popStatus.Groups.Clear(); PopListGroup StatusGroup = new PopListGroup { Title = "类型" }; for (int i = 0; i < 6; i++) { switch (i) { case 0: { PopListItem item = new PopListItem { Value = i.ToString(), Text = "在用" }; StatusGroup.Items.Add(item); break; } case 1: { PopListItem item = new PopListItem { Value = i.ToString(), Text = "闲置" }; StatusGroup.Items.Add(item); break; } case 2: { PopListItem item = new PopListItem { Value = i.ToString(), Text = "送测" }; StatusGroup.Items.Add(item); break; } case 3: { PopListItem item = new PopListItem { Value = i.ToString(), Text = "外借" }; StatusGroup.Items.Add(item); break; } case 4: { PopListItem item = new PopListItem { Value = i.ToString(), Text = "损坏" }; StatusGroup.Items.Add(item); break; } case 5: { PopListItem item = new PopListItem { Value = i.ToString(), Text = "未知" }; StatusGroup.Items.Add(item); break; } } } popStatus.Groups.Add(StatusGroup); popStatus.ShowDialog(); } catch (Exception ex) { Toast(ex.Message); } }