private void LoadPjtType() { using (Entities context = new Entities()) { var query = from q in context.ProjectType select q; foreach (var q in query) { //建立容器 SideNavPanel snp = new SideNavPanel(); snp.Dock = System.Windows.Forms.DockStyle.Fill; //内部列表 ListBoxAdv listbox = new ListBoxAdv(); listbox.Dock = DockStyle.Fill; listbox.AutoScroll = true; listbox.ItemDoubleClick += Listbox_ItemDoubleClick; var pjtlistquery = from p in context.Project where p.projettype == q.projtype select p; listbox.DisplayMember = "projectname"; listbox.DataSource = pjtlistquery.ToList(); snp.Controls.Add(listbox); _ProjListAdvDic.Add(q.projtype, listbox); //建立边栏按钮 SideNavItem sin = new SideNavItem(); sin.Checked = false; sin.Panel = snp; sin.Text = q.projtype; sideNav1.Controls.Add(snp); sideNav1.Items.Add(sin); } } }
protected SideNavItem AddSideNavItem() { SideNavItem item = new SideNavItem(); SideNavPanel panel = new SideNavPanel(); panel.Dock = DockStyle.Fill; item.Panel = panel; mySideNav1.Controls.Add(panel); mySideNav1.Items.Add(item); return(item); }
private void Listbox_ItemDoubleClick(object sender, MouseEventArgs e) { sideNav2.Items.Clear(); _DocListAdvDic.Clear(); BaseItem bc = sender as BaseItem; using (Entities context = new Entities()) { var query = from q in context.Document where q.projname == bc.Text group q by q.doctypename into g select new { type = g.Key, doc = g }; foreach (var q in query) { //建立容器 SideNavPanel snp = new SideNavPanel(); snp.Dock = System.Windows.Forms.DockStyle.Fill; //内部列表 ListBoxAdv listbox = new ListBoxAdv(); listbox.Dock = DockStyle.Fill; listbox.AutoScroll = true; listbox.ItemDoubleClick += DocList_ItemDounleChick; listbox.ItemClick += Listbox_ItemCheck; var pjtlistquery = from p in context.Document where p.doctypename == q.type select p; listbox.DisplayMember = "docname"; listbox.DataSource = pjtlistquery.ToList(); snp.Controls.Add(listbox); _DocListAdvDic.Add(q.type, listbox); //建立边栏按钮 SideNavItem sin = new SideNavItem(); sin.Checked = false; sin.Panel = snp; sin.Text = q.type; sideNav2.Controls.Add(snp); sideNav2.Items.Add(sin); } } sideNav2.Refresh(); }
private LayoutControl AddSide([Required] string assembly, int count) { var layout = new LayoutControl { Dock = DockStyle.Fill, ForeColor = System.Drawing.Color.Black, Location = new System.Drawing.Point(0, 0), Margin = new System.Windows.Forms.Padding(6, 6, 6, 6), Name = $"{assembly}Layout" }; var combo = new ComboBox() { DropDownStyle = ComboBoxStyle.DropDownList }; if (count <= 50) { combo.Items.Add("<All>"); combo.SelectedIndex = 0; } combo.SelectedIndexChanged += ChangedExtensionType; layout.Controls.Add(combo); layout.RootGroup.Items.Add(new LayoutControlItem() { Control = combo, Padding = new System.Windows.Forms.Padding(8, 8, 8, 8), TextVisible = true, Text = "Extension Type", Height = combo.Height, HeightType = eLayoutSizeType.Absolute, Width = 85, WidthType = DevComponents.DotNetBar.Layout.eLayoutSizeType.Percent }); var label = new Label() { Text = $"Count: {count}", TextAlign = ContentAlignment.MiddleRight, Width = 10 }; layout.Controls.Add(label); layout.RootGroup.Items.Add(new LayoutControlItem() { Control = label, Padding = new System.Windows.Forms.Padding(8, 8, 8, 8), TextVisible = false, Height = 46, HeightType = eLayoutSizeType.Absolute, Width = 15, WidthType = DevComponents.DotNetBar.Layout.eLayoutSizeType.Percent }); var panel = new SideNavPanel { Dock = DockStyle.Fill, Name = $"{assembly}Panel", Location = new Point(10, 10) }; panel.Controls.Add(layout); _side.Items.Add(new SideNavItem() { Name = assembly, Text = $"{assembly.Replace("ThreatsManager.", "")} ({count})", Panel = panel }); _side.Controls.Add(panel); return(layout); }