//格式化选择的控件 private void FormatCtl(Rectangle pRect, CommandID cmdID) { DesignControlList ctlList = DesignerHost.SectionList.GetActiveSection().DesignControls; foreach (DesignControl ctl in ctlList) { if (!ctl.IsSelected) { continue; } DIYReport.Interface.IRptSingleObj dataObj = ctl.DataObj; if (cmdID.Equals(StandardCommands.AlignLeft)) { dataObj.Location = new Point(pRect.Left, ctl.Top); } else if (cmdID.Equals(StandardCommands.AlignTop)) { dataObj.Location = new Point(ctl.Left, pRect.Top); } else if (cmdID.Equals(StandardCommands.AlignRight)) { dataObj.Location = new Point(pRect.Right - ctl.Width, ctl.Top); } else if (cmdID.Equals(StandardCommands.AlignBottom)) { dataObj.Location = new Point(ctl.Left, pRect.Top + pRect.Height - ctl.Height); //ctl.Top = pRect.Top + pRect.Height - ctl.Height ; } else if (cmdID.Equals(StandardCommands.SizeToControlWidth)) { dataObj.Size = new Size(pRect.Width, ctl.Height); //ctl.Width = pRect.Width ; } else if (cmdID.Equals(StandardCommands.SizeToControlHeight)) { dataObj.Size = new Size(ctl.Width, pRect.Height); //ctl.Height = pRect.Height ; } else { Debug.Assert(false, "Command" + cmdID.ID.ToString() + "没有处理。"); return; } } DesignerHost.SectionList.GetActiveSection().DesignControls.ShowFocusHandle(true); }
public DesignSection(DIYReport.ReportModel.RptSection pDataObj) { InitializeComponent(); picMain.Paint += new PaintEventHandler(picMain_Paint); this.Width = pDataObj.Width; this.Height = pDataObj.Height; _DataObj = pDataObj; updateByDataObj(); _DataObj.AfterValueChanged += new RptEventHandler(_DataObj_AfterValueChanged); _DesignControls = new DesignControlList(this); // if(_SectionType == DIYReport.SectionType.Detail){ // //在刚开始设计的时候只有Detail Section 是默认显示的 // _IsDisplay = true; // panBottomMove.Visible = true; // //panTopMove.Visible = false; // } _IsDisplay = pDataObj.Visibled; panBottomMove.Visible = _IsDisplay; pDataObj.HasCreateViewDesign = true; }