static void DrawPopulationInfo(PanelBrick panel, RectangleF r, string text, double portion, double scale) { RectangleF barRect = GetBarRect(r, portion, scale); r.Height = barRect.Top - r.Top; TextBrick textBrick = new TextBrick(); textBrick.Sides = BorderSide.None; textBrick.BackColor = panel.BackColor; textBrick.Rect = r; textBrick.ForeColor = panel.Style.ForeColor; textBrick.Text = text; textBrick.Font = panel.Style.Font; textBrick.Padding = new PaddingInfo(1, 0, 0, 0); textBrick.StringFormat = panel.Style.StringFormat; panel.Bricks.Add(textBrick); VisualBrick barBrick = new VisualBrick(); barBrick.Sides = BorderSide.All; barBrick.BackColor = Color.FromArgb(232, 216, 195); barBrick.Rect = barRect; barBrick.BorderColor = Color.FromArgb(173, 148, 116); barBrick.BorderStyle = BrickBorderStyle.Inset; panel.Bricks.Add(barBrick); }
protected virtual void CreateRecordBrick(XRDataRecord currentRecord, PanelBrick parentBrick, ref float actualHeight) { if (IsDesignMode || (parentBrick is DataContainerBrick && !((DataContainerBrick)parentBrick).IsHeader)) { CreateBricksForRecord(currentRecord, parentBrick, false, ref actualHeight); } }
static void DrawPopulationInfo(PanelBrick panel, RectangleF r, string text, double portion, double scale) { RectangleF barRect = GetBarRect(r, portion, scale); r.Height = barRect.Top - r.Top; BrickStyle textStyle = new BrickStyle() { ForeColor = panel.Style.ForeColor, BackColor = Color.Transparent, Font = panel.Style.Font }; textStyle.ChangeAlignment(TextAlignment.BottomLeft); TextBrick textBrick = new TextBrick(textStyle); textBrick.Rect = r; textBrick.Text = text; panel.Bricks.Add(textBrick); BrickStyle barStyle = new BrickStyle() { Sides = BorderSide.All, BorderColor = Color.FromArgb(173, 148, 116), BorderStyle = BrickBorderStyle.Inset, BorderWidth = 1, BackColor = Color.FromArgb(232, 216, 195), }; VisualBrick barBrick = new VisualBrick(barStyle); barBrick.Rect = barRect; panel.Bricks.Add(barBrick); }
private void ExportFirstLine(PrintCellHelperInfo info, PanelBrick brick) { Rectangle rect = panelControl1.Bounds; rect.Height = dateEdit_Begin.Bounds.Height; ExportText(info, rect, "Begin Time", brick); }
private void ExportPanel(PrintCellHelperInfo info, PanelBrick brick) { ExportFirstLine(info, brick); ExportSecondLine(info, brick); ExportThirdLine(info, brick); ExportFourthLine(info, brick); }
protected override void CreateBricksForRecord(XRDataRecord record, PanelBrick parentBrick, bool isHeader, ref float actualHeight) { XRTreeListNode node = record as XRTreeListNode; PrintNodeEventArgs args = new PrintNodeEventArgs(node); if (!isHeader) { TreeList.OnPrintNode(args); } if (args.SuppressType == NodeSuppressType.Leave) { int nodeLevel = node.Level; TreeListNodeBrick nodeBrick = new TreeListNodeBrick(TreeList, (DataContainerBrick)parentBrick, isHeader); nodeBrick.Style = XRControlStyle.Default.Clone() as XRControlStyle; nodeBrick.Separable = false; RecordPrintCache cache = new TreeListNodePrintCache(nodeBrick, node.Level); List <VisualBrick> childBricks = new List <VisualBrick>(); List <XRFieldHeader> visibleHeaders = TreeList.VisibleHeaders; for (int i = 0; i < visibleHeaders.Count; i++) { VisualBrick valueBrick = CreateCellBrick(TreeList, parentBrick, node, i, isHeader); childBricks.Add(valueBrick); } CorrectBrickBounds(nodeBrick, childBricks, nodeLevel * TreeList.NodeIndent, actualHeight); float nodeHeight = nodeBrick.Rect.Height; VisualBrickHelper.SetBrickBounds(nodeBrick, nodeBrick.Rect, TreeList.Dpi); parentBrick.Bricks.Add(nodeBrick); actualHeight += nodeHeight; if (!IsDesignMode) { if (isHeader) { ((DataContainerBrick)parentBrick).PrintCache.HeaderCache = cache; } else { ((DataContainerBrick)parentBrick).PrintCache.RecordsCache.Add(cache); } } } if (args.SuppressType != NodeSuppressType.SuppressWithChildren) { foreach (XRTreeListNode childNode in node.Nodes) { CreateBricksForRecord(childNode, parentBrick, isHeader, ref actualHeight); } } }
private void ExportFourthLine(PrintCellHelperInfo info, PanelBrick brick) { Rectangle rect = panelControl1.Bounds; rect.Y += progressBarControl1.Bounds.Y; rect.Height = info.Rectangle.Bottom - rect.Y - info.Rectangle.Y; ExportText(info, rect, "Progress", brick); }
private void ExportSecondLine(PrintCellHelperInfo info, PanelBrick brick) { Rectangle rect = panelControl1.Bounds; rect.Y += dateEdit_Now.Bounds.Y; rect.Height = dateEdit_Now.Bounds.Height; ExportText(info, rect, "Now Time", brick); }
TextBrick CreateTextBrick(PanelBrick panelBrick) { TextBrick textBrick = new TextBrick(); textBrick.Sides = BorderSide.None; textBrick.BackColor = Color.Transparent; panelBrick.Bricks.Add(textBrick); return(textBrick); }
void link_CreateDetailArea(object sender, CreateAreaEventArgs e) { int maxPages = 0; foreach (XtraReport x in reports) { x.CreateDocument(); maxPages = Math.Max(maxPages, x.Pages.Count); } SizeF pageSize = e.Graph.ClientPageSize; float sectionHeight = reports != null && reports.Count() > 1 ? pageSize.Height / reports.Count() : 0; PanelBrick section; for (int pageIndex = 0; pageIndex < maxPages; pageIndex++) { for (int sectionIndex = 0; sectionIndex < reports.Count; sectionIndex++) { section = new PanelBrick { Size = new SizeF(e.Graph.ClientPageSize.Width, sectionHeight), BorderWidth = 0 }; if (reports[sectionIndex].Pages.Count < pageIndex + 1) { section.Bricks.Add(new LineBrick() { Rect = section.Rect, LineDirection = DevExpress.XtraReports.UI.LineDirection.Slant, ForeColor = Color.Red, LineStyle = System.Drawing.Drawing2D.DashStyle.Dash, BorderWidth = 0 }); section.Bricks.Add(new LineBrick() { Rect = section.Rect, LineDirection = DevExpress.XtraReports.UI.LineDirection.BackSlant, ForeColor = Color.Red, BackColor = Color.Transparent, LineStyle = System.Drawing.Drawing2D.DashStyle.Dash, BorderWidth = 1, BorderColor = Color.Red, BorderDashStyle = DevExpress.XtraPrinting.BorderDashStyle.Dash, BorderStyle = BrickBorderStyle.Inset }); } else { foreach (Brick brick in ((PSPage)reports[sectionIndex].Pages[pageIndex]).Bricks) { section.Bricks.Add(brick); } } e.Graph.Modifier = BrickModifier.None; e.Graph.Modifier = BrickModifier.Detail; e.Graph.DrawBrick(section); } } }
protected void CreateDetails(PanelBrick parentBrick, ref float actualHeight) { LoadData(); XRDataRecordCollection actualCollection = GetActualDataCollection(); for (int i = 0; i < actualCollection.Count; i++) { CreateRecordBrick(actualCollection[i], parentBrick, ref actualHeight); } }
// Override the XRControl.PutStateToBrick method. protected override void PutStateToBrick(VisualBrick brick, PrintingSystemBase ps) { // Call the PutStateToBrick method of the base class. base.PutStateToBrick(brick, ps); // Get the Panel brick which represents the current progress receiveBar control. PanelBrick panel = (PanelBrick)brick; panel.BackColor = Color.Transparent; int width = Convert.ToInt32(Math.Round(panel.Rect.Width)); int height = Convert.ToInt32(Math.Round(panel.Rect.Height)); Bitmap bitmap = new Bitmap(width, height); bitmap.SetResolution(300, 300); GdiGraphics gBmp = new GdiGraphics(Graphics.FromImage(bitmap), ps); //int colorWidth = Convert.ToInt32(Math.Round(width * (Position / MaxValue))); //int colorWid = Convert.ToInt32(Math.Round((MaxValue-width) * (Position / MaxValue))); gBmp.FillEllipse(new SolidBrush(panel.Style.ForeColor), new Rectangle(0, 0, width, height)); //gBmp.FillRectangle(new SolidBrush(panel.Style.ForeColor), new Rectangle(0, 0, colorWidth, height)); // gBmp.FillRectangle(new SolidBrush(panel.Style.BackColor), new Rectangle(0,colorWidth, colorWid, height)); //String drawString = Position.ToString(); //// //drawString += " %"; //Font drawFont = new Font("Frutiger LT Arabic 55", 9); //SolidBrush drawBrush = new SolidBrush(Color.Black); //StringFormat drawFormat = new StringFormat(); //drawFormat.Alignment = StringAlignment.Center; //drawFormat.LineAlignment = StringAlignment.Center; //gBmp.DrawString(drawString, drawFont, drawBrush, new Rectangle(0, 0, width, height), drawFormat); gBmp.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; ImageBrick image = new ImageBrick(); image.Rect = new RectangleF(0, 0, panel.Rect.Width, panel.Rect.Height); image.SizeMode = ImageSizeMode.Squeeze; image.Image = bitmap; image.BackColor = Color.Transparent; image.Sides = BorderSide.None; panel.Bricks.Add(image); panel.BackColor = Color.Transparent; }
protected override void PutStateToBrick(VisualBrick brick, PrintingSystemBase ps) { base.PutStateToBrick(brick, ps); PanelBrick panel = (PanelBrick)brick; VisualBrick progressBar = new VisualBrick(this); progressBar.Sides = BorderSide.None; progressBar.BackColor = panel.Style.ForeColor; progressBar.Rect = new RectangleF(0, 0, panel.Rect.Width * (Position / MaxValue), panel.Rect.Height); panel.Bricks.Add(progressBar); }
private void ExportDateEdit(PrintCellHelperInfo info, DateEdit editor, PanelBrick brick) { Rectangle rect = editor.Bounds; rect.Width = info.Rectangle.Right - rect.X - info.Rectangle.X; PrintCellHelperInfo inf = new PrintCellHelperInfo(info.LineColor, info.PS, editor.DateTime, editor.Properties.Appearance, editor.Properties.DisplayFormat.GetDisplayText(editor.EditValue), rect, info.Graph, DevExpress.Utils.HorzAlignment.Near, true, true, editor.Properties.DisplayFormat.GetFormatString(), BorderSide.All); TextBrick tb = (TextBrick)editor.Properties.GetBrick(inf); tb.Rect = rect; brick.Bricks.Add(tb); }
private void ExportProgressBar(PrintCellHelperInfo info, PanelBrick brick) { Rectangle rect = progressBarControl1.Bounds; rect.Width = info.Rectangle.Right - rect.X - info.Rectangle.X; rect.Height = info.Rectangle.Bottom - rect.Y - info.Rectangle.Y; PrintCellHelperInfo inf = new PrintCellHelperInfo(info.LineColor, info.PS, progressBarControl1.Position, progressBarControl1.Properties.Appearance, progressBarControl1.Properties.DisplayFormat.GetDisplayText(progressBarControl1.Position), rect, info.Graph, DevExpress.Utils.HorzAlignment.Near, true, true, progressBarControl1.Properties.DisplayFormat.GetFormatString(), BorderSide.All); ProgressBarBrick pbb = (ProgressBarBrick)progressBarControl1.Properties.GetBrick(inf); pbb.Rect = rect; brick.Bricks.Add(pbb); }
protected override void PutStateToBrick(VisualBrick brick, PrintingSystemBase ps) { base.PutStateToBrick(brick, ps); PanelBrick panelBrick = (PanelBrick)brick; Graphics gr = Graphics.FromHwnd(new IntPtr(0)); gr.PageUnit = GraphicsUnit.Document; RectangleF rect = RectangleF.Empty; try { if (displayTitle && !string.IsNullOrEmpty(TitleText) && titleFont != null) { rect.Size = gr.MeasureString(TitleText, titleFont, (int)panelBrick.Rect.Width); TextBrick textBrick = CreateTextBrick(panelBrick); textBrick.Rect = rect; textBrick.ForeColor = TitleColor; textBrick.Font = TitleFont; textBrick.Text = TitleText; } if (!string.IsNullOrEmpty(this.Text)) { TextBrick textBrick2 = CreateTextBrick(panelBrick); textBrick2.ForeColor = this.ForeColor; textBrick2.Font = this.Font; textBrick2.Text = this.Text; if (this.contextTextAlignment == ContextTextAlignmentEnum.NextToTitleText) { float width = Math.Max(0, panelBrick.Rect.Width - rect.Width); SizeF size = gr.MeasureString(this.Text, this.Font, (int)width); textBrick2.Rect = new RectangleF(rect.Right + 10f, rect.Top, width, size.Height); } else { StringFormat sf = new StringFormat(); sf.LineAlignment = GraphicsConvertHelper.ToVertStringAlignment(this.TextAlignment); sf.Alignment = GraphicsConvertHelper.ToHorzStringAlignment(this.TextAlignment); SizeF size = gr.MeasureString(this.Text, this.Font, (int)panelBrick.Rect.Width, sf); textBrick2.Rect = new RectangleF(rect.Left, rect.Bottom + 10f, panelBrick.Rect.Width, size.Height); textBrick2.StringFormat = new BrickStringFormat(sf); } } } catch { } finally { gr.Dispose(); } }
public IVisualBrick GetBrick(PrintCellHelperInfo info) { this.EditValue = info.EditValue; PanelBrick brick = new PanelBrick(); brick.BackColor = Color.White; ExportProgressBar(info, brick); ExportDateEdit(info, dateEdit_Begin, brick); ExportDateEdit(info, dateEdit_End, brick); ExportDateEdit(info, dateEdit_Now, brick); ExportPanel(info, brick); return(brick); }
protected override void CreateBricksForRecord(XRDataRecord record, PanelBrick parentBrick, bool isHeader, ref float actualHeight) { PrintRecordEventArgs args = new PrintRecordEventArgs(record); if (!isHeader) { Grid.OnPrintRecord(args); } if (!args.Cancel) { GridRecordBrick recordBrick = new GridRecordBrick(Grid, (DataContainerBrick)parentBrick, isHeader); recordBrick.Style = XRControlStyle.Default.Clone() as XRControlStyle; recordBrick.Separable = false; RecordPrintCache cache = new RecordPrintCache(recordBrick); List <VisualBrick> childBricks = new List <VisualBrick>(); List <XRFieldHeader> visibleHeaders = Grid.VisibleHeaders; for (int i = 0; i < visibleHeaders.Count; i++) { VisualBrick valueBrick = CreateCellBrick(Grid, parentBrick, record, i, isHeader); childBricks.Add(valueBrick); } CorrectBrickBounds(recordBrick, childBricks, 0, actualHeight); float recordHeight = recordBrick.Rect.Height; VisualBrickHelper.SetBrickBounds(recordBrick, recordBrick.Rect, Grid.Dpi); parentBrick.Bricks.Add(recordBrick); actualHeight += recordHeight; if (!IsDesignMode) { if (isHeader) { ((DataContainerBrick)parentBrick).PrintCache.HeaderCache = cache; } else { ((DataContainerBrick)parentBrick).PrintCache.RecordsCache.Add(cache); } } } }
protected override void CreateHeaders(PanelBrick parentBrick, ref float actualHeight) { if (IsDesignMode || (parentBrick is DataContainerBrick && ((DataContainerBrick)parentBrick).IsHeader)) { XRDataRecord headerRecord = TableControl.CreateDataRecord(); List <XRFieldHeader> visibleHeaders = TableControl.VisibleHeaders; for (int i = 0; i < visibleHeaders.Count; i++) { headerRecord[i] = visibleHeaders[i].Caption; } CreateBricksForRecord(headerRecord, parentBrick, true, ref actualHeight); } }
protected override void PutStateToBrick(VisualBrick brick, PrintingSystemBase ps) { if (this.LineStyle != System.Drawing.Drawing2D.DashStyle.Custom) { base.PutStateToBrick(brick, ps); } else { PanelBrick panel = (PanelBrick)brick; panel.BackColor = Color.Transparent; panel.Sides = BorderSide.None; int i; if (this.LineDirection == LineDirection.Horizontal) { for (i = 0; i < Convert.ToInt32(panel.Rect.Width / (this.Dash + this.Space)); i++) { LineBrick dashBrick = new LineBrick(); dashBrick.Sides = BorderSide.None; dashBrick.BackColor = panel.Style.ForeColor; dashBrick.Rect = new RectangleF(i * (this.Dash + this.Space), panel.Rect.Height / 2 - this.LineWidth / 2, this.dash, this.LineWidth); panel.Bricks.Add(dashBrick); } LineBrick endBrick = new LineBrick(); endBrick.Sides = BorderSide.None; endBrick.BackColor = panel.Style.ForeColor; endBrick.Rect = new RectangleF(i * (this.Dash + this.Space), panel.Rect.Height / 2 - this.LineWidth / 2, panel.Rect.Width - i * (this.Dash + this.Space), this.LineWidth); panel.Bricks.Add(endBrick); } else if (this.LineDirection == LineDirection.Vertical) { for (i = 0; i < Convert.ToInt32(panel.Rect.Height / (this.Dash + this.Space)); i++) { LineBrick dashBrick = new LineBrick(); dashBrick.Sides = BorderSide.None; dashBrick.BackColor = panel.Style.ForeColor; dashBrick.Rect = new RectangleF(panel.Rect.Width / 2 - this.LineWidth / 2, i * (this.Dash + this.Space), this.LineWidth, this.Dash); panel.Bricks.Add(dashBrick); } LineBrick endBrick = new LineBrick(); endBrick.Sides = BorderSide.None; endBrick.BackColor = panel.Style.ForeColor; endBrick.Rect = new RectangleF(panel.Rect.Width / 2 - this.LineWidth / 2, i * (this.Dash + this.Space), this.LineWidth, panel.Rect.Height - i * (this.Dash + this.Space)); panel.Bricks.Add(endBrick); } } }
// Override the XRControl.PutStateToBrick method. protected override void PutStateToBrick(VisualBrick brick, PrintingSystemBase ps) { // Call the PutStateToBrick method of the base class. base.PutStateToBrick(brick, ps); // Get the Panel brick which represents the current progress bar control. PanelBrick panel = (PanelBrick)brick; // Create a new VisualBrick to be inserted into the panel brick. VisualBrick progressBar = new VisualBrick(this); // Hide borders. progressBar.Sides = BorderSide.None; // Set the foreground color to fill the completed area of a progress bar. progressBar.BackColor = panel.Style.ForeColor; // Calculate the rectangle to be filled by the foreground color. progressBar.Rect = new RectangleF(0, 0, panel.Rect.Width * (Position / MaxValue), panel.Rect.Height); // Add the VisualBrick to the panel. panel.Bricks.Add(progressBar); }
protected virtual void CreateBricksForRecord(XRDataRecord record, PanelBrick parentBrick, bool isHeader, ref float actualHeight) { }
private static void ExportText(PrintCellHelperInfo info, Rectangle rect, string text, PanelBrick brick) { PrintCellHelperInfo inf = new PrintCellHelperInfo(info.LineColor, info.PS, text, info.Appearace, text, rect, info.Graph, DevExpress.Utils.HorzAlignment.Near, true, true, info.TextValueFormatString, BorderSide.All); using (RepositoryItemTextEdit repTE = new RepositoryItemTextEdit()) { TextBrick tb = (TextBrick)repTE.GetBrick(inf); tb.Rect = rect; brick.Bricks.Add(tb); } }
protected virtual void CreateHeaders(PanelBrick parentBrick, ref float actualHeight) { }