private void addMenuCommand(CommandID cmdID, XCMenuItem menuItem, int imageIndex, bool enabled) { menuItem.Enabled = enabled; menuItem.Tag = cmdID; menuItem.ImageIndex = imageIndex; _CMenuCommands[cmdID] = menuItem; menuItem.Click += new EventHandler(menuItem_Click); }
private void menuItem_Click(object sender, EventArgs e) { XCMenuItem menuItem = sender as XCMenuItem; if (menuItem != null) { _RptDesignExec.ExecCommand(menuItem.Tag as CommandID); } }
/// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器 /// 修改此方法的内容。 /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(XDesignPanel)); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.panMain = new System.Windows.Forms.Panel(); this.panRightBottom = new System.Windows.Forms.Panel(); this.panDesign = new System.Windows.Forms.Panel(); this.vscrBar = new System.Windows.Forms.VScrollBar(); this.hscrBar = new System.Windows.Forms.HScrollBar(); this.rulerLeft = new DIYReport.UserDIY.DesignRuler(); this.rulerTop = new DIYReport.UserDIY.DesignRuler(); this.panLeftTop = new System.Windows.Forms.Panel(); this.contextMenu1 = new System.Windows.Forms.ContextMenu(); this.mItemBringToFront = new DIYReport.UserDIY.XCMenuItem(); this.mItemSendToBack = new DIYReport.UserDIY.XCMenuItem(); this.menuItem3 = new DIYReport.UserDIY.XCMenuItem(); this.mItemCut = new DIYReport.UserDIY.XCMenuItem(); this.mItemCopy = new DIYReport.UserDIY.XCMenuItem(); this.mItemPast = new DIYReport.UserDIY.XCMenuItem(); this.menuItem7 = new DIYReport.UserDIY.XCMenuItem(); this.mItemDelete = new DIYReport.UserDIY.XCMenuItem(); this.menuItem19 = new DIYReport.UserDIY.XCMenuItem(); this.menuItem9 = new DIYReport.UserDIY.XCMenuItem(); this.mItemInsertTopMargin = new DIYReport.UserDIY.XCMenuItem(); this.mItemInsertReportHeader = new DIYReport.UserDIY.XCMenuItem(); this.mItemInsertPageHeader = new DIYReport.UserDIY.XCMenuItem(); this.mItemInsertGroupHeader = new DIYReport.UserDIY.XCMenuItem(); this.mItemInsertDataDetail = new DIYReport.UserDIY.XCMenuItem(); this.mItemInsertGroupFooter = new DIYReport.UserDIY.XCMenuItem(); this.mItemPageFooter = new DIYReport.UserDIY.XCMenuItem(); this.mItemReportFooter = new DIYReport.UserDIY.XCMenuItem(); this.mItemBottomMargin = new DIYReport.UserDIY.XCMenuItem(); this.panMain.SuspendLayout(); this.SuspendLayout(); // // imageList1 // this.imageList1.ImageSize = new System.Drawing.Size(16, 16); this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.TransparentColor = System.Drawing.Color.Transparent; // // panMain // this.panMain.BackColor = System.Drawing.SystemColors.AppWorkspace; this.panMain.Controls.Add(this.panRightBottom); this.panMain.Controls.Add(this.panDesign); this.panMain.Controls.Add(this.vscrBar); this.panMain.Controls.Add(this.hscrBar); this.panMain.Controls.Add(this.rulerLeft); this.panMain.Controls.Add(this.rulerTop); this.panMain.Controls.Add(this.panLeftTop); this.panMain.Dock = System.Windows.Forms.DockStyle.Fill; this.panMain.Location = new System.Drawing.Point(0, 0); this.panMain.Name = "panMain"; this.panMain.Size = new System.Drawing.Size(520, 320); this.panMain.TabIndex = 2; // // panRightBottom // this.panRightBottom.BackColor = System.Drawing.SystemColors.Control; this.panRightBottom.Location = new System.Drawing.Point(496, 296); this.panRightBottom.Name = "panRightBottom"; this.panRightBottom.Size = new System.Drawing.Size(16, 16); this.panRightBottom.TabIndex = 5; // // panDesign // this.panDesign.BackColor = System.Drawing.Color.White; this.panDesign.Location = new System.Drawing.Point(24, 24); this.panDesign.Name = "panDesign"; this.panDesign.Size = new System.Drawing.Size(448, 264); this.panDesign.TabIndex = 4; this.panDesign.Resize += new System.EventHandler(this.panDesign_Resize); // // vscrBar // this.vscrBar.Location = new System.Drawing.Point(496, 24); this.vscrBar.Name = "vscrBar"; this.vscrBar.Size = new System.Drawing.Size(17, 277); this.vscrBar.TabIndex = 3; this.vscrBar.Scroll += new System.Windows.Forms.ScrollEventHandler(this.vscrBar_Scroll); // // hscrBar // this.hscrBar.Location = new System.Drawing.Point(24, 296); this.hscrBar.Name = "hscrBar"; this.hscrBar.Size = new System.Drawing.Size(472, 17); this.hscrBar.TabIndex = 2; this.hscrBar.Scroll += new System.Windows.Forms.ScrollEventHandler(this.hscrBar_Scroll); // // rulerLeft // this.rulerLeft.BackColor = System.Drawing.SystemColors.AppWorkspace; this.rulerLeft.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("rulerLeft.BackgroundImage"))); this.rulerLeft.BeginDrawPoint = 16; this.rulerLeft.IsHorizontal = false; this.rulerLeft.Location = new System.Drawing.Point(0, 24); this.rulerLeft.Name = "rulerLeft"; this.rulerLeft.Size = new System.Drawing.Size(24, 294); this.rulerLeft.TabIndex = 1; // // rulerTop // this.rulerTop.BackColor = System.Drawing.SystemColors.AppWorkspace; this.rulerTop.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("rulerTop.BackgroundImage"))); this.rulerTop.BeginDrawPoint = 0; this.rulerTop.IsHorizontal = true; this.rulerTop.Location = new System.Drawing.Point(24, 0); this.rulerTop.Name = "rulerTop"; this.rulerTop.Size = new System.Drawing.Size(496, 24); this.rulerTop.TabIndex = 0; // // panLeftTop // this.panLeftTop.BackColor = System.Drawing.SystemColors.Control; this.panLeftTop.Location = new System.Drawing.Point(0, 0); this.panLeftTop.Name = "panLeftTop"; this.panLeftTop.Size = new System.Drawing.Size(24, 24); this.panLeftTop.TabIndex = 0; // // contextMenu1 // this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.mItemBringToFront, this.mItemSendToBack, this.menuItem3, this.mItemCut, this.mItemCopy, this.mItemPast, this.menuItem7, this.mItemDelete, this.menuItem19, this.menuItem9 }); // // mItemBringToFront // this.mItemBringToFront.Index = 0; this.mItemBringToFront.Tag = null; this.mItemBringToFront.Text = "置于最前端"; // // mItemSendToBack // this.mItemSendToBack.Index = 1; this.mItemSendToBack.Tag = null; this.mItemSendToBack.Text = "置于最底端"; // // menuItem3 // this.menuItem3.Index = 2; this.menuItem3.Tag = null; this.menuItem3.Text = "-"; // // mItemCut // this.mItemCut.Index = 3; this.mItemCut.Tag = null; this.mItemCut.Text = "剪切(&T)"; // // mItemCopy // this.mItemCopy.Index = 4; this.mItemCopy.Tag = null; this.mItemCopy.Text = "复制(&C)"; // // mItemPast // this.mItemPast.Index = 5; this.mItemPast.Tag = null; this.mItemPast.Text = "粘贴(&P)"; // // menuItem7 // this.menuItem7.Index = 6; this.menuItem7.Tag = null; this.menuItem7.Text = "-"; // // mItemDelete // this.mItemDelete.Index = 7; this.mItemDelete.Tag = null; this.mItemDelete.Text = "删除(&D)"; // // menuItem19 // this.menuItem19.Index = 8; this.menuItem19.Tag = null; this.menuItem19.Text = "-"; // // menuItem9 // this.menuItem9.Index = 9; this.menuItem9.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.mItemInsertTopMargin, this.mItemInsertReportHeader, this.mItemInsertPageHeader, this.mItemInsertGroupHeader, this.mItemInsertDataDetail, this.mItemInsertGroupFooter, this.mItemPageFooter, this.mItemReportFooter, this.mItemBottomMargin }); this.menuItem9.Tag = null; this.menuItem9.Text = "插入 Section"; // // mItemInsertTopMargin // this.mItemInsertTopMargin.Index = 0; this.mItemInsertTopMargin.Tag = null; this.mItemInsertTopMargin.Text = "上边距"; // // mItemInsertReportHeader // this.mItemInsertReportHeader.Index = 1; this.mItemInsertReportHeader.Tag = null; this.mItemInsertReportHeader.Text = "报表 Header"; // // mItemInsertPageHeader // this.mItemInsertPageHeader.Index = 2; this.mItemInsertPageHeader.Tag = null; this.mItemInsertPageHeader.Text = "页 Header"; // // mItemInsertGroupHeader // this.mItemInsertGroupHeader.Index = 3; this.mItemInsertGroupHeader.Tag = null; this.mItemInsertGroupHeader.Text = "分组 Header"; // // mItemInsertDataDetail // this.mItemInsertDataDetail.Index = 4; this.mItemInsertDataDetail.Tag = null; this.mItemInsertDataDetail.Text = "数据区"; // // mItemInsertGroupFooter // this.mItemInsertGroupFooter.Index = 5; this.mItemInsertGroupFooter.Tag = null; this.mItemInsertGroupFooter.Text = "分组 Footer"; // // mItemPageFooter // this.mItemPageFooter.Index = 6; this.mItemPageFooter.Tag = null; this.mItemPageFooter.Text = "页 Footer"; // // mItemReportFooter // this.mItemReportFooter.Index = 7; this.mItemReportFooter.Tag = null; this.mItemReportFooter.Text = "报表 Footer"; // // mItemBottomMargin // this.mItemBottomMargin.Index = 8; this.mItemBottomMargin.Tag = null; this.mItemBottomMargin.Text = "下边距"; // // XDesignPanel // this.ContextMenu = this.contextMenu1; this.Controls.Add(this.panMain); this.Name = "XDesignPanel"; this.Size = new System.Drawing.Size(520, 320); this.Resize += new System.EventHandler(this.ReportDesign_Resize); this.Load += new System.EventHandler(this.ReportDesign_Load); this.panMain.ResumeLayout(false); this.ResumeLayout(false); }