private void AddSection(EbReportSection section) { if (section.Panel == null) { section.Panel = new Panel { Dock = DockStyle.Top, Height = 100, BackColor = Color.Transparent }; Color btnColor = Color.White; if (section.Type == EbReportSectionType.ReportHeader || section.Type == EbReportSectionType.ReportFooter) { btnColor = Color.LightSeaGreen; } else if (section.Type == EbReportSectionType.PageHeader || section.Type == EbReportSectionType.PageFooter) { btnColor = Color.LightSkyBlue; } else if (section.Type == EbReportSectionType.Detail) { btnColor = Color.SandyBrown; } var sectionlbl = new Label { Dock = DockStyle.Left, BackColor = btnColor, Width = 35 }; sectionlbl.Tag = section; sectionlbl.MouseClick += Sectionlbl_MouseClick; section.Panel.Controls.Add(sectionlbl); if (pDesignerCore1 == null) { pDesignerCore1 = new pF.pDesigner.pDesigner(this.MainForm.PropertyWindow); pDesignerCore1.BackColor = Color.Transparent; pDesignerCore1.Parent = this; (pDesignerCore1 as IpDesigner).Toolbox = this.MainForm.Toolbox.listBox1; } (pDesignerCore1 as IpDesigner).AddReportSectionDesignSurface(section.Panel, this); } (section.Panel.Controls[0] as Label).Text = section.Name; this.Controls.Add(section.Panel); this.Controls.Add(new Splitter { Dock = DockStyle.Top, BackColor = Color.DarkBlue, Width = 0 }); }
private void Sectionlbl_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { _justNowClickedSection = (sender as Label).Tag as EbReportSection; var itemInsertAbove = new MenuItem("Insert Section Above"); var itemInsertBelow = new MenuItem("Insert Section Below"); var itemDeleteSection = new MenuItem("Delete Section"); itemInsertAbove.Click += ItemInsertAbove_Click; itemInsertBelow.Click += ItemInsertBelow_Click; itemDeleteSection.Click += ItemDeleteSection_Click; (sender as Label).ContextMenu = new ContextMenu(new MenuItem[] { itemInsertAbove, itemInsertBelow, itemDeleteSection }); } }