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 Form1_Load(object sender, EventArgs e) { string s = "XtraPrinting Library"; BrickGraphics brickGraph = printingSystem1.Graph; VisualBrick visBrick = new VisualBrick(); // Specify the style BrickStyle bStyle = new BrickStyle(BorderSide.Bottom, 2, Color.Gold, Color.Navy, Color.DodgerBlue, new Font("Arial", 14, FontStyle.Bold | FontStyle.Italic), new BrickStringFormat(StringAlignment.Far, StringAlignment.Near)); // Start the report generation. printingSystem1.Begin(); // Create bricks. brickGraph.Modifier = BrickModifier.Detail; visBrick = brickGraph.DrawString(s, new RectangleF(0, 0, 250, 40)); visBrick = brickGraph.DrawString(s, new RectangleF(0, 40, 250, 40)); // Apply the style to the current brick. visBrick.Style = bStyle; // Finish the report generation. printingSystem1.End(); }
private StyleProperty GetStyleProperties(BrickStyle style) { //Had to use Reflection PropertyInfo pi = typeof(BrickStyle).GetProperty("SetProperties", BindingFlags.NonPublic | BindingFlags.Instance); return((StyleProperty)pi.GetValue(style, null)); }
public static void FillHtmlTableCellCore(IHtmlExportProvider exportProvider, BrickStyle style, XRDataCellPosition position) { using (BrickStyle curStyle = DataCellExportHelper.GetResultingStyle(exportProvider.HtmlExportContext.MainExportMode == HtmlExportMode.SingleFile, style, position)) { DevExpress.XtraPrinting.Export.Web.HtmlBuilderBase.HtmlCellLayout areaLayout = new DevExpress.XtraPrinting.Export.Web.HtmlBuilderBase.HtmlCellLayout(curStyle); exportProvider.CurrentCell.Attributes["class"] = RegisterHtmlClassName(exportProvider.HtmlExportContext, curStyle, areaLayout.Borders, areaLayout.Padding); } }
protected override void DrawObject(IGraphics gr, RectangleF rect) { using (BrickStyle curStyle = DataCellExportHelper.GetResultingStyle(gr is OnePageImageGraphics, DataCellCheckBrick.Style, DataCellCheckBrick.CellPosition)) { this.BrickPaint.BrickStyle = curStyle; base.DrawObject(gr, rect); } }
protected override void FillXlTableCellInternal(IXlExportProvider exportProvider) { using (BrickStyle curStyle = DataCellExportHelper.GetResultingStyle(false, DataCellCheckBrick.Style, DataCellCheckBrick.CellPosition)) { curStyle.Sides = BorderSide.All; ((BrickViewData)exportProvider.CurrentData).Style = curStyle; base.FillXlTableCellInternal(exportProvider); } }
public static string RegisterHtmlClassName(HtmlExportContext context, BrickStyle style, PaddingInfo borders, PaddingInfo padding) { if (style == null) { return(String.Empty); } string htmlStyle = PSHtmlStyleRender.GetHtmlStyle(style.Font, style.ForeColor, style.BackColor, style.BorderColor, borders, padding, style.BorderDashStyle, context.RightToLeftLayout); return(context.ScriptContainer.RegisterCssClass(htmlStyle)); }
protected override BrickStyle CreateBrickStyle(XRDataContainerControl control, VisualBrick parentBrick, VisualBrick valueBrick, XRDataRecord record, int fieldIndex, bool isHeader) { BrickStyle style = base.CreateBrickStyle(control, parentBrick, valueBrick, record, fieldIndex, isHeader); if (!isHeader) { PrintCellEventArgs printCellArgs = new PrintNodeCellEventArgs((XRTreeListNode)record, (XRTreeListColumn)control.VisibleHeaders[fieldIndex], valueBrick, style); TreeList.OnPrintNodeCell((PrintNodeCellEventArgs)printCellArgs); } return(style); }
protected Size MeasureTextSize(string text, float width, float dpi, BrickStyle style, PrintingSystemBase ps) { float convertedWidth = GraphicsUnitConverter.Convert(width, dpi, GraphicsDpi.Document); style.Padding.DeflateWidth(convertedWidth); ps.Graph.PageUnit = GraphicsUnit.Document; ps.Graph.Font = style.Font; SizeF size = ps.Graph.MeasureString(text, (int)convertedWidth, style.StringFormat.Value); size.Height += GraphicsUnitConverter.Convert((float)2f, GraphicsDpi.Pixel, GraphicsDpi.Document); return(Size.Ceiling(GraphicsUnitConverter.Convert(style.Padding.Inflate(size, GraphicsDpi.Document), GraphicsDpi.Document, dpi))); }
protected override void PrintGroupRow(int rowHandle, int level) { Rectangle r = Rectangle.Empty; r.X = Indent + level * ViewViewInfo.LevelIndent; r.Width = this.fMaxRowWidth - r.Left; r.Y = Y; r.Height = CurrentRowHeight; int textWidth; ImageBrick ib; Bitmap bmp = new Bitmap(r.Width, r.Height); GraphicsCache cache = new GraphicsCache(Graphics.FromImage(bmp)); RowObjectCustomDrawEventArgs args = View.GetRowObjectCustomDrawEventArgs(cache, rowHandle, r, out textWidth); if (args == null) { base.PrintGroupRow(rowHandle, level); return; } ib = new ImageBrick(); ib.Rect = r; ib.Image = bmp; ib.BackColor = Color.Transparent; _graph.DrawBrick(ib, ib.Rect); r.Width = textWidth; // if (View.OptionsPrint.UsePrintStyles) SetDefaultBrickStyle(Graph, Bricks["GroupRow"]); // else { AppearanceObject rowAppearance = View.GetLevelStyle(level, true); BrickStyle tempStyle = new BrickStyle(Bricks["GroupRow"].Sides, Bricks["GroupRow"].BorderWidth, Color.Transparent /*rowAppearance.BorderColor*/, rowAppearance.BackColor, rowAppearance.ForeColor, rowAppearance.Font, Bricks["GroupRow"].StringFormat); tempStyle.TextAlignment = DevExpress.XtraPrinting.Native.TextAlignmentConverter.ToTextAlignment(rowAppearance.TextOptions.HAlignment, rowAppearance.TextOptions.VAlignment); SetDefaultBrickStyle(Graph, tempStyle); } string groupText = View.GetGroupRowDisplayText(rowHandle); ITextBrick textBrick = DrawTextBrick(Graph, groupText, r, true); textBrick.Text = textBrick.Text.Replace(Environment.NewLine, ""); textBrick.BackColor = Color.Transparent; textBrick.TextValue = View.GetGroupRowPrintValue(rowHandle); Y += r.Height; }
public void Reset() { IsActive = false; WireRed = false; WireGreen = false; WireBlue = false; TileColor = 0; Type = 0; Wall = 0; LiquidType = 0; WallColor = 0; LiquidAmount = 0; BrickStyle = 0; Actuator = false; InActive = false; }
private void button1_Click(object sender, EventArgs e) { printingSystem1.Begin(); // Specify the style definitions. BrickStyle column_style1 = new BrickStyle(BorderSide.Left | BorderSide.Bottom | BorderSide.Top, 2, Color.Gold, Color.Navy, Color.DodgerBlue, new Font("Arial", 6, FontStyle.Bold | FontStyle.Italic), new BrickStringFormat(StringAlignment.Near, StringAlignment.Near)); BrickStyle column_style2 = new BrickStyle(BorderSide.Top | BorderSide.Bottom, 2, Color.Navy, Color.DodgerBlue, Color.Gold, new Font("Arial", 6, FontStyle.Bold | FontStyle.Italic), new BrickStringFormat(StringAlignment.Center, StringAlignment.Center)); BrickStyle column_style3 = new BrickStyle(BorderSide.Right | BorderSide.Bottom | BorderSide.Top, 2, Color.DodgerBlue, Color.Gold, Color.Navy, new Font("Arial", 6, FontStyle.Bold | FontStyle.Italic), new BrickStringFormat(StringAlignment.Far, StringAlignment.Far)); BrickGraphics gr = printingSystem1.Graph; gr.Modifier = BrickModifier.Detail; string s = "XtraPrinting Library"; TextBrick t_brick = new TextBrick(); // Draw the first column and apply the style. for (int i = 0; i < 3; i++) { t_brick = gr.DrawString(s, new RectangleF(0, 20 * i, 100, 20)); t_brick.Style = column_style1; } // Draw the second column and apply the style. for (int i = 0; i < 3; i++) { t_brick = gr.DrawString(s, new RectangleF(100, 20 * i, 100, 20)); t_brick.Style = column_style2; } // Draw the first column and apply the style. for (int i = 0; i < 3; i++) { t_brick = gr.DrawString(s, new RectangleF(200, 20 * i, 100, 20)); t_brick.Style = column_style3; } printingSystem1.End(); printingSystem1.PreviewFormEx.Show(); }
protected virtual BrickStyle CreateBrickStyle(XRDataContainerControl control, VisualBrick parentBrick, VisualBrick valueBrick, XRDataRecord record, int fieldIndex, bool isHeader) { BrickStyle style = GetActualBrickStyle((DataContainerBrick)parentBrick, isHeader); if (isHeader) { PrintCellEventArgs printCellArgs = new PrintCellEventArgs(control.VisibleHeaders[fieldIndex], valueBrick, style); ContainerControl.OnPrintHeaderCell(printCellArgs); ((IDataCellBrick)valueBrick).CellPosition |= XRDataCellPosition.Header; } else { PrintRecordCellEventArgs printCellArgs = new PrintRecordCellEventArgs(record, control.VisibleHeaders[fieldIndex], valueBrick, style); ContainerControl.OnPrintRecordCell(printCellArgs); } return(style); }
public static BrickStyle GetResultingStyle(bool isSingleFileMode, BrickStyle originalStyle, XRDataCellPosition position) { BrickStyle style = new BrickStyle(originalStyle); style.StringFormat = BrickStringFormat.Create(style.TextAlignment, style.StringFormat.WordWrap); BorderSide sides = originalStyle.Sides; if (sides.HasFlag(BorderSide.Right) && !position.HasFlag(XRDataCellPosition.RightMost)) { style.Sides &= ~BorderSide.Right; } if (sides.HasFlag(BorderSide.Bottom) && sides.HasFlag(BorderSide.Top) && !position.HasFlag(XRDataCellPosition.Header)) { style.Sides &= ~BorderSide.Top; } if (position.HasFlag(XRDataCellPosition.HigherLevel) && sides.HasFlag(BorderSide.Top)) { style.Sides |= BorderSide.Top; } if (position.HasFlag(XRDataCellPosition.LowerLevel) && sides.HasFlag(BorderSide.Bottom) && sides.HasFlag(BorderSide.Top)) { style.Sides &= ~BorderSide.Bottom; } if (!isSingleFileMode) { if (position.HasFlag(XRDataCellPosition.FirstOnPage)) { style.Sides &= ~BorderSide.Top; } if (position.HasFlag(XRDataCellPosition.LastOnPage) && sides.HasFlag(BorderSide.Bottom)) { style.Sides |= BorderSide.Bottom; } } return(style); }
void ApplyAppearanceToBrickStyleCore(IVisualBrick brick, IPivotPrintAppearance appearance) { BrickStyle brickStyle = brick.Style != null ? (BrickStyle)brick.Style.Clone() : (BrickStyle)Graph.DefaultBrickStyle.Clone(); if (appearance.Options.UseBackColor) { brickStyle.BackColor = appearance.BackColor; } if (appearance.Options.UseBorderColor) { brickStyle.BorderColor = appearance.BorderColor; } if (appearance.Options.UseBorderWidth) { brickStyle.BorderWidth = appearance.BorderWidth; } if (appearance.Options.UseBorderStyle) { brickStyle.BorderStyle = appearance.BorderStyle; } if (appearance.Options.UseFont) { brickStyle.Font = appearance.Font; } if (appearance.Options.UseForeColor) { brickStyle.ForeColor = appearance.ForeColor; } if (appearance.Options.UseTextOptions) { brickStyle.TextAlignment = TextAlignmentConverter.ToTextAlignment(appearance.TextHorizontalAlignment, appearance.TextVerticalAlignment); brickStyle.StringFormat = new BrickStringFormat(appearance.StringFormat); } brickStyle.StringFormat.PrototypeKind = BrickStringFormatPrototypeKind.GenericTypographic; brick.Style = brickStyle; }
private void SetPixelAutomatic(Tile curTile, int? tile = null, int? wall = null, byte? liquid = null, LiquidType? liquidType = null, bool? wire = null, short? u = null, short? v = null, bool? wire2 = null, bool? wire3 = null, BrickStyle? brickStyle = null, bool? actuator = null, bool? actuatorInActive = null, int? tileColor = null, int? wallColor = null) { // Set Tile Data if (u != null) curTile.U = (short)u; if (v != null) curTile.V = (short)v; if (tile != null) { if (tile == -1) { curTile.Type = 0; curTile.IsActive = false; } else { curTile.Type = (ushort)tile; curTile.IsActive = true; } } if (actuator != null && curTile.IsActive) { curTile.Actuator = (bool)actuator; } if (actuatorInActive != null && curTile.IsActive) { curTile.InActive = (bool)actuatorInActive; } if (brickStyle != null && TilePicker.BrickStyleActive) { curTile.BrickStyle = (BrickStyle)brickStyle; } if (wall != null) curTile.Wall = (byte)wall; if (liquid != null) { curTile.LiquidAmount = (byte)liquid; } if (liquidType != null) { curTile.LiquidType = (LiquidType)liquidType; } if (wire != null) curTile.WireRed = (bool)wire; if (wire2 != null) curTile.WireGreen = (bool)wire2; if (wire3 != null) curTile.WireBlue = (bool)wire3; if (tileColor != null) { if (curTile.IsActive) { curTile.TileColor = (byte)tileColor; } else { curTile.TileColor = (byte)0; } } if (wallColor != null) { if (curTile.Wall != 0) { curTile.WallColor = (byte)wallColor; } else { curTile.WallColor = (byte)0; } } if (curTile.IsActive) if (World.TileProperties[curTile.Type].IsSolid) curTile.LiquidAmount = 0; }
public override void PrintHeader(IBrickGraphics graph) { vert = new BrickStyle(Bricks["HeaderPanel"]); vert.StringFormat = vert.StringFormat.ChangeFormatFlags(StringFormatFlags.DirectionVertical | StringFormatFlags.DirectionRightToLeft); base.PrintHeader(graph); if (!View.OptionsPrint.PrintHeader) { return; } Point indent = new Point(Indent, HeaderY); Rectangle r = Rectangle.Empty; bool usePrintStyles = View.OptionsPrint.UsePrintStyles; SetDefaultBrickStyle(graph, Bricks["HeaderPanel"]); int HeaderHeight = (this.View as CustomBandedGridView).HeaderHeightOnExport; Dictionary <PrintColumnInfo, ITextBrick> columnBricks = new Dictionary <PrintColumnInfo, ITextBrick>(); foreach (PrintColumnInfo col in Columns) { if (!usePrintStyles) { AppearanceObject temp = new AppearanceObject(); AppearanceHelper.Combine(temp, new AppearanceObject[] { col.Column.AppearanceHeader, View.Appearance.HeaderPanel, AppearancePrint.HeaderPanel }); SetDefaultBrickStyle(graph, Bricks.Create(temp, BorderSide.All, temp.BorderColor, 1)); } r = col.Bounds; r = new Rectangle(r.Location, new Size(r.Width, HeaderHeight)); r.Offset(indent); MethodInfo mi = typeof(GridColumn).GetMethod("GetTextCaptionForPrinting", BindingFlags.NonPublic | BindingFlags.Instance); string caption = (string)mi.Invoke(col.Column, new object[] { });//col.Column.GetTextCaptionForPrinting(); if (!col.Column.OptionsColumn.ShowCaption) { caption = string.Empty; } ITextBrick itb = DrawTextBrick(graph, caption, r); if ((col.Column is CustomBandedColumn) && ((col.Column as CustomBandedColumn).CaptionVerticalOnExport)) { itb.Style = vert; } else { SetDefaultBrickStyle(graph, Bricks["HeaderPanel"]); } if (caption.Contains(Environment.NewLine)) { itb.Style.StringFormat = BrickStringFormat.Create(itb.Style.TextAlignment, true); } if (AppearancePrint.HeaderPanel.TextOptions.WordWrap == WordWrap.NoWrap && View.OptionsPrint.UsePrintStyles) { using (Graphics g = this.View.GridControl.CreateGraphics()) { SizeF s = g.MeasureString(itb.Text, itb.Font, 1000, itb.StringFormat.Value); if (s.Width + 5 >= r.Width) { itb.Text = ""; itb.TextValue = ""; } } } columnBricks.Add(col, itb); using (Graphics g = this.View.GridControl.CreateGraphics()) { SizeF s = g.MeasureString(itb.Text, itb.Font, 1000, itb.StringFormat.Value); if (s.Height + 5 >= r.Height) { itb.Text = ""; itb.TextValue = ""; } } } }
protected override void SetDefaultBrickStyle(IBrickGraphics graph, BrickStyle style) { base.SetDefaultBrickStyle(graph, style); }
protected string RegisterHtmlClassName(HtmlExportContext context, BrickStyle style, PaddingInfo borders, PaddingInfo padding) { return(DataCellExportHelper.RegisterHtmlClassName(context, style, borders, padding)); }
public PrintRecordCellEventArgs(XRDataRecord currentRecord, XRFieldHeader header, VisualBrick brick, BrickStyle style) : base(header, brick, style) { this.record = currentRecord; }
public PrintNodeCellEventArgs(XRTreeListNode currentNode, XRTreeListColumn column, VisualBrick brick, BrickStyle style) : base(column, brick, style) { this.node = currentNode; }
public PrintCellEventArgs(XRFieldHeader header, VisualBrick brick, BrickStyle style) { this.header = header; this.brick = brick; this.style = style; }