| | |
| | | using DevExpress.XtraReports.UI; |
| | | using DevExpress.XtraCharts; |
| | | using DevExpress.XtraReports.UI; |
| | | using System; |
| | | using System.Collections; |
| | | using System.ComponentModel; |
| | |
| | | //A4设置 827 1169 |
| | | this.PaperKind = DevExpress.Drawing.Printing.DXPaperKind.A4; |
| | | this.Margins = new DevExpress.Drawing.DXMargins(50, 50, 50, 50); |
| | | |
| | | //内容宽度 |
| | | float contentWidth = 727F;//内容宽度 |
| | | float firstCaptionHeight = 30F;//一级标题高度 |
| | | |
| | | //727 1069 |
| | | |
| | |
| | | |
| | | #region 一、项目概述 |
| | | |
| | | var labForDescription = new XRLabel(); |
| | | labForDescription.AnchorHorizontal = (DevExpress.XtraReports.UI.HorizontalAnchorStyles.Left | DevExpress.XtraReports.UI.HorizontalAnchorStyles.Right); |
| | | labForDescription.Font = new DevExpress.Drawing.DXFont("Arial", 12F, DevExpress.Drawing.DXFontStyle.Bold); |
| | | labForDescription.LocationFloat = new DevExpress.Utils.PointFloat(0F, locationY); |
| | | labForDescription.Multiline = true; |
| | | labForDescription.Name = "labForDescription"; |
| | | labForDescription.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); |
| | | labForDescription.SizeF = new System.Drawing.SizeF(727F, 25F); |
| | | labForDescription.StylePriority.UseFont = false; |
| | | labForDescription.StylePriority.UseTextAlignment = false; |
| | | labForDescription.Text = "一、项目概述"; |
| | | labForDescription.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; |
| | | var labForDescription = CreateFirstCaption("一、项目概述", contentWidth, firstCaptionHeight, 0F, locationY); |
| | | this.Detail.Controls.Add(labForDescription); |
| | | locationY += 25F; |
| | | locationY += firstCaptionHeight; |
| | | |
| | | #endregion |
| | | |
| | |
| | | |
| | | // 将表格添加到Detail |
| | | this.Detail.Controls.Add(tableForPumpList); |
| | | locationY += 30F; |
| | | locationY += 30F * vm.PumpList.Count; |
| | | } |
| | | |
| | | if (vm.WorkingList != null && vm.WorkingList.Count > 0) |
| | | { |
| | | foreach (var working in vm.WorkingList) |
| | | { |
| | | XRChart chart = new XRChart(); |
| | | chart.LocationF = new DevExpress.Utils.PointFloat(0F, locationY); |
| | | chart.WidthF = contentWidth; |
| | | chart.HeightF = 300F; |
| | | |
| | | // 创建一个线系列 |
| | | Series series = new Series("Series1", ViewType.Spline); |
| | | |
| | | // 添加数据点 |
| | | foreach (var item in working.PumpAnaly.Items[0].RatedCurveQH) |
| | | { |
| | | series.Points.Add(new SeriesPoint(item.X, item.Y)); |
| | | } |
| | | |
| | | chart.Series.Add(series); |
| | | |
| | | |
| | | Detail.Controls.Add(chart); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //创建一级标题 |
| | | private XRLabel CreateFirstCaption(string caption, float sizeX, float sizeY, float locationX, float locationY) |
| | | { |
| | | var lab = new XRLabel(); |
| | | lab.AnchorHorizontal = (DevExpress.XtraReports.UI.HorizontalAnchorStyles.Left | DevExpress.XtraReports.UI.HorizontalAnchorStyles.Right); |
| | | lab.Font = new DevExpress.Drawing.DXFont("Arial", 12F, DevExpress.Drawing.DXFontStyle.Bold); |
| | | lab.LocationFloat = new DevExpress.Utils.PointFloat(locationX, locationY); |
| | | lab.Multiline = true; |
| | | lab.Name = "lab"; |
| | | lab.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); |
| | | lab.SizeF = new System.Drawing.SizeF(sizeX, sizeY); |
| | | lab.StylePriority.UseFont = false; |
| | | lab.StylePriority.UseTextAlignment = false; |
| | | lab.Text = caption; |
| | | lab.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; |
| | | return lab; |
| | | } |
| | | |
| | | |
| | | // 创建表头单元格 |
| | | private XRTableCell CreateTableCell(string text, int width) |
| | | { |