private void button1_Click(object sender, EventArgs e)
        {
            // Obtain the PrintingSystem's graphics.
            BrickGraphics gr = printingSystem1.Graph;

            // Load an image from a file.
            Image img = Image.FromFile(@"..\..\Fish.png");

            // Create an ImageBrick and specify its properties.
            ImageBrick ibrk = new ImageBrick();

            ibrk.Image       = img;
            ibrk.Sides       = BorderSide.All;
            ibrk.BorderColor = Color.Blue;
            ibrk.BorderWidth = 10;

            // Start report generation.
            printingSystem1.Begin();

            // Add the ImageBrick to the Detail section of the report.
            RectangleF r = new RectangleF(new PointF(0, 0), new SizeF(256, 160));

            gr.Modifier = BrickModifier.Detail;
            gr.DrawBrick(ibrk, r);

            // Finish report generation.
            printingSystem1.End();

            // Display the Print Preview form.
            printingSystem1.PreviewFormEx.Show();
        }
Example #2
0
 private void CustomDrawFooterCells(IBrickGraphics graph)
 {
     if (!View.OptionsPrint.PrintFooter)
     {
         return;
     }
     foreach (PrintColumnInfo colInfo in Columns)
     {
         if (colInfo.Column.SummaryItem.SummaryType == SummaryItemType.None)
         {
             continue;
         }
         Rectangle r = Rectangle.Empty;
         r.X      = colInfo.Bounds.X + Indent;
         r.Y      = colInfo.RowIndex * FooterPanelHeight + 2 + Y;
         r.Width  = colInfo.Bounds.Width;
         r.Height = FooterPanelHeight * colInfo.RowCount;
         r.X     -= Indent;
         r.Y     -= r.Height;
         string     text = string.Empty;
         ImageBrick ib   = GetImageBrick(colInfo, r, out text);
         if (ib != null)
         {
             graph.DrawBrick(ib, ib.Rect); // old line
         }
     }
 }
        public override int CreateArea(string areaName, IBrickGraphics graph)
        {
            this.PrintingTable.AdjustSize();

            int m_x = this.PrintingTable.Offset.Width;
            int m_y = this.PrintingTable.Offset.Height;

            WebbTableCell m_cell = null;

            int m_row = 0, m_col = 0;

            m_cell = this.PrintingTable.GetCell(m_row, m_col) as WebbTableCell;

            ImageBrick m_ImageBrick = m_cell.CreateImageBrick();

            graph.DrawBrick(m_ImageBrick, new RectangleF(m_x, m_y, m_cell.CellStyle.Width, m_cell.CellStyle.Height));

            this.CreateClickAreas(graph);             //Added this code at 2008-11-11 14:49:58@Simon
//			switch(this.Settings.ChartType)
//			{
//				case ChartAppearanceType.Bar:
//					break;
//				case ChartAppearanceType.Pie:
//					break;
//				case ChartAppearanceType.Point:
//					break;
//				default:
//					break;
//			}
            return(m_y + m_cell.CellStyle.Height);
        }
Example #4
0
        public override void CreateArea(string areaName, IBrickGraphics graph)
        {
            this.PrintingTable.AdjustSize();

            int m_x = this.PrintingTable.Offset.Width;
            int m_y = this.PrintingTable.Offset.Height;

            WebbTableCell m_cell = null;

            int m_row = 0, m_col = 0;

            m_cell = this.PrintingTable.GetCell(m_row, m_col) as WebbTableCell;

            ImageBrick m_ImageBrick = m_cell.CreateImageBrick();

            graph.DrawBrick(m_ImageBrick, new RectangleF(m_x, m_y, m_cell.CellStyle.Width, m_cell.CellStyle.Height));

            switch (this._AppearanceType)
            {
            case ChartAppearanceType.Bar:
                this.CreateClickAreaForBarChart(areaName, graph);
                break;

            case ChartAppearanceType.Pie:
                this.CreateClickAreaForPieChart(areaName, graph);
                break;

            case ChartAppearanceType.Point:
                break;

            default:
                break;
            }
        }
        void l_CreateDetailArea(object sender, CreateAreaEventArgs e)
        {
            Link       l  = sender as Link;
            ImageBrick ib = new ImageBrick();

            ib.Rect  = new RectangleF(0, 0, chartControl1.Width, chartControl1.Height);
            ib.Image = mf;
            e.Graph.DrawBrick(ib);
        }
Example #6
0
        // 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 IVisualBrick DrawHeaderBrick(PivotFieldItemBase field, Rectangle bounds)
        {
            IPivotPrintAppearance appearance = GetFieldAppearance(field);

            SetDefaultBrickStyle(appearance, CellSizeProvider.FieldValueTextOffset, 0, 0, 0);

            string       text  = field.Caption;
            IVisualBrick brick = CreateTextBrick();

            brick.Text = text.Substring(MyPivotGridControl.ImagePlaceHolder.Length);
            if (text != null)
            {
                brick.TextValue = text;
            }
            brick.TextValueFormatString = "";
            int imageIndex = ((PivotGridField)this.Data.GetField(field)).ImageIndex;

            if (imageIndex > -1)
            {
                ImageBrick ib = new ImageBrick(BorderSide.None, 0, Color.Red, Color.Transparent);
                ib.Image = ((ImageList)this.PivotGridControl.HeaderImages).Images[imageIndex];
                int imageWidth  = ib.Image.Width;
                int imageHeight = ib.Image.Height;
                ib.BackColor   = brick.BackColor;
                ib.BorderColor = brick.BorderColor;
                brick.Sides    = BorderSide.Top | BorderSide.Right | BorderSide.Bottom;
                ib.BorderStyle = brick.BorderStyle;
                ib.BorderWidth = brick.BorderWidth;
                ib.Sides       = BorderSide.Top | BorderSide.Left | BorderSide.Bottom;
                ib.SizeMode    = ImageSizeMode.CenterImage;

                //Graph.DrawBrick(ib, new Rectangle(bounds.X, bounds.Y + (bounds.Height - imageHeight) / 2, imageWidth, imageHeight));
                Graph.DrawBrick(ib, new Rectangle(bounds.X, bounds.Y, imageWidth, bounds.Height));
                Graph.DrawBrick(brick, new Rectangle(bounds.X + imageWidth, bounds.Y, bounds.Width - imageWidth, bounds.Height));
            }
            else
            {
                Graph.DrawBrick(brick, new Rectangle(bounds.X, bounds.Y, bounds.Width, bounds.Height));
            }
            brick.Separable = false;
            if (Owner != null)
            {
                if (Owner.CustomExportHeader(ref brick, field, appearance, ref bounds))
                {
                    ApplyAppearanceToBrickStyle(brick, appearance);
                }
            }
            return(brick);
        }
Example #8
0
        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;
        }
Example #9
0
            public override DevExpress.XtraPrinting.IVisualBrick GetBrick(PrintCellHelperInfo info)
            {
                Bitmap   bmp = new Bitmap(info.Rectangle.Width, info.Rectangle.Height);
                Graphics gr  = Graphics.FromImage(bmp);

                gr.FillRectangle(new SolidBrush(Color.White), info.Rectangle);
                ImageBrick brick = new ImageBrick(BorderSide.None, 0, Color.Transparent, Color.Transparent);
                int        width = Convert.ToInt32(info.Rectangle.Width * Convert.ToDouble(info.EditValue) / ((double)100));

                if (width > 0)
                {
                    gr.FillRectangle(new LinearGradientBrush(new Rectangle(0, 0, width, info.Rectangle.Height), Color.LightBlue, Color.White, 90, true), new Rectangle(0, 0, width, info.Rectangle.Height));
                    brick.Image = bmp;
                }
                gr.DrawString(info.DisplayText, info.Appearace.Font, new SolidBrush(Color.Black), new PointF(0, 0));
                brick.Rect = info.Rectangle;
                return(brick);
            }
Example #10
0
        private ImageBrick GetImageBrick(PrintColumnInfo colInfo, Rectangle rect, out string displayText)
        {
            Bitmap        bmp   = new Bitmap(rect.Width, rect.Height);
            GraphicsCache cache = new GraphicsCache(Graphics.FromImage(bmp));
            FooterCellCustomDrawEventArgs args = (View as MyGridView).GetCustomDrawCellArgs(cache, rect, colInfo.Column);

            displayText = args.Info.DisplayText;
            if (!args.Handled)
            {
                return(null);
            }
            BorderSide border = args.Appearance.Options.UseBorderColor? BorderSide.All: BorderSide.None;
            ImageBrick ib     = new ImageBrick(border, 1, args.Appearance.BorderColor, args.Appearance.BackColor);

            ib.Rect  = rect;
            ib.Image = bmp;
            cache.Dispose();
            return(ib);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            // Start report generation.
            printingSystem1.Begin();

            // Obtain the Printing System's graphics.
            BrickGraphics gr = printingSystem1.Graph;

            // Specify graphics settings.
            gr.Modifier    = BrickModifier.Detail;
            gr.BackColor   = Color.FromArgb(26, 26, 154);
            gr.BorderColor = Color.FromArgb(254, 202, 2);

            // Insert a text brick.
            string    s         = "XtraPrinting Library";
            TextBrick textBrick = new TextBrick();

            textBrick = gr.DrawString(s, Color.FromArgb(67, 145, 252),
                                      new RectangleF(0, 0, 286, 80), BorderSide.All);
            textBrick.Font = new Font("Arial", 20, FontStyle.Bold | FontStyle.Italic);
            BrickStringFormat bsf = new BrickStringFormat(StringAlignment.Center,
                                                          StringAlignment.Center);

            textBrick.StringFormat = bsf;

            // Insert a page break.
            printingSystem1.InsertPageBreak(81);

            // Insert an image brick.
            Image      img        = Image.FromFile(@"..\..\logo.png");
            ImageBrick imageBrick = new ImageBrick();

            imageBrick = gr.DrawImage(img, new RectangleF(0, 81, 286, 81));

            // Finish report generation.
            printingSystem1.End();

            // Display the Print Preview form.
            printingSystem1.PreviewFormEx.Show();
        }
        public override IVisualBrick GetBrick(PrintCellHelperInfo info)
        {
            TextBrick  contentBrick = (TextBrick)base.GetBrick(info);
            ImageBrick imgBrick     = new ImageBrick();

            IPanelBrick panelBrick = new XETextPanelBrick(CreateBrickStyle(info, "panel"));

            SetCommonBrickProperties(panelBrick, info);
            panelBrick.Bricks.Add(imgBrick);
            panelBrick.Bricks.Add(contentBrick);

            imgBrick.Image   = GetImage();
            imgBrick.Size    = ContentImageSize;
            panelBrick.Style = contentBrick.Style;

            contentBrick.Location = new PointFloat(imgBrick.Location.X + imgBrick.Size.Width, 0);
            contentBrick.Sides    = BorderSide.None;
            contentBrick.Size     = new SizeF(info.Rectangle.Size.Width - imgBrick.Size.Width, info.Rectangle.Size.Height);
            panelBrick.Rect       = new RectangleF(0, 0, contentBrick.Rect.Width + imgBrick.Size.Width, contentBrick.Rect.Height);


            return(panelBrick);
        }
Example #13
0
        private void PrintRowIndicator(IBrickGraphics graph, int rowHandle)
        {
            string        displayText;
            ImageBrick    ib;
            Rectangle     rect  = new Rectangle(new Point(Indent, Y - 21), new Size(this.View.IndicatorWidth, this.CurrentRowHeight));
            Bitmap        bmp   = new Bitmap(rect.Width, rect.Height);
            GraphicsCache cache = new GraphicsCache(Graphics.FromImage(bmp));

            cache.Paint = new DevExpress.Utils.Paint.XPaint();
            RowIndicatorCustomDrawEventArgs args = (View as MyGridView).GetCustomDrawRowIndicatorArgs(cache, rect);

            displayText = args.Info.DisplayText;

            BorderSide border = args.Appearance.Options.UseBorderColor ? BorderSide.All : BorderSide.None;

            ib       = new ImageBrick(border, 1, args.Appearance.BorderColor, args.Appearance.BackColor);
            ib.Rect  = rect;
            ib.Image = bmp;
            if (ib == null)
            {
            }
            graph.DrawBrick(ib, rect);
        }
        private ImageBrick GetImageBrick(Rectangle rect, DrawElementInfo element)
        {
            ImageBrick ib = new ImageBrick(BorderSide.None, 0, AppearancePrint.HeaderPanel.BorderColor, AppearancePrint.HeaderPanel.BackColor);

            ib.Rect = rect;
            GlyphElementInfoArgs glyphInfo = element.ElementInfo as GlyphElementInfoArgs;

            if (glyphInfo.Glyph != null)
            {
                ib.Image = glyphInfo.Glyph;
            }
            else
            {
                if (glyphInfo.ImageIndex < 0)
                {
                    return(null);
                }

                if (glyphInfo.ImageList is ImageCollection)
                {
                    ImageCollection imageList = glyphInfo.ImageList as ImageCollection;
                    ib.Image = imageList.Images[glyphInfo.ImageIndex];
                }
                else if (glyphInfo.ImageList is ImageList)
                {
                    ImageList imageList = glyphInfo.ImageList as ImageList;
                    ib.Image = imageList.Images[glyphInfo.ImageIndex];
                }
                else
                {
                    SharedImageCollection collection = glyphInfo.ImageList as SharedImageCollection;
                    ib.Image = collection.ImageSource.Images[glyphInfo.ImageIndex];
                }
            }

            return(ib);
        }
        public override void PrintHeader(IBrickGraphics 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"]);

            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.Offset(indent);
                string caption = col.Column.GetTextCaption();
                if (!ColumnsInfo[Columns.IndexOf(col)].Column.OptionsColumn.ShowCaption)
                {
                    caption = string.Empty;
                }

                DevExpress.XtraGrid.Drawing.GridColumnInfoArgs columnsInfo = ColumnsInfo[Columns.IndexOf(col)];
                DrawElementInfoCollection innerElements   = columnsInfo.InnerElements;
                DrawElementInfo           columnImageInfo = null;
                GlyphElementInfoArgs      elementInfo     = null;
                this.ViewViewInfo.Painter.ElementsPainter.Column.CalcObjectBounds(columnsInfo);
                for (int i = 0; i < innerElements.Count; i++)
                {
                    if (innerElements[i].ElementInfo is DevExpress.Utils.Drawing.GlyphElementInfoArgs)
                    {
                        columnImageInfo = innerElements[i];
                        elementInfo     = columnImageInfo.ElementInfo as GlyphElementInfoArgs;
                        break;
                    }
                }

                ITextBrick tBrick = null;
                if (elementInfo.Glyph == null && elementInfo.ImageIndex < 0)
                {
                    tBrick = DrawTextBrick(graph, caption, r);
                }
                else
                {
                    IPanelBrick panelBrick      = new XETextPanelBrick(graph.DefaultBrickStyle);
                    float       offsetForBorder = panelBrick.BorderWidth;

                    if (columnImageInfo.Alignment != StringAlignment.Center)
                    {
                        tBrick       = new TextBrick();
                        tBrick.Rect  = new RectangleF(offsetForBorder, offsetForBorder, r.Width, r.Height);
                        tBrick.Text  = caption;
                        tBrick.Style = graph.DefaultBrickStyle;
                        tBrick.Sides = BorderSide.None;
                        panelBrick.Bricks.Add(tBrick);
                    }

                    panelBrick.Value = caption;
                    Rectangle columnRect = r;
                    Rectangle imageRect  = new Rectangle(new Point((int)offsetForBorder, (int)offsetForBorder), elementInfo.GlyphSize);
                    imageRect.Y = r.Y + columnImageInfo.ElementInterval;

                    switch (columnImageInfo.Alignment)
                    {
                    case StringAlignment.Near:
                        tBrick.Rect = new RectangleF(new PointF(imageRect.Location.X + imageRect.Size.Width, tBrick.Rect.Y), tBrick.Rect.Size);
                        MakeInflate(ref tBrick, 2 * offsetForBorder, 2 * offsetForBorder);
                        break;

                    case StringAlignment.Center:
                    {
                        imageRect.X += (r.Width - imageRect.Width) / 2;
                    }
                    break;

                    case StringAlignment.Far:
                        tBrick.Rect = new RectangleF(tBrick.Rect.Location, new SizeF(tBrick.Rect.Width - imageRect.Width, tBrick.Rect.Height));
                        MakeInflate(ref tBrick, 2 * offsetForBorder, 2 * offsetForBorder);
                        imageRect.X = (int)tBrick.Rect.Right;
                        break;
                    }


                    ImageBrick iBrick = GetImageBrick(imageRect, columnImageInfo);
                    if (iBrick != null)
                    {
                        panelBrick.Bricks.Add(iBrick);
                    }

                    graph.DrawBrick(panelBrick, columnRect);
                }


                if (tBrick == null)
                {
                    continue;
                }

                if (AppearancePrint.HeaderPanel.TextOptions.WordWrap == WordWrap.NoWrap && View.OptionsPrint.UsePrintStyles)
                {
                    using (Graphics g = this.View.GridControl.CreateGraphics())
                    {
                        SizeF s = g.MeasureString(tBrick.Text, tBrick.Font, 1000, tBrick.StringFormat.Value);
                        if (s.Width + 5 >= r.Width)
                        {
                            tBrick.Text      = "";
                            tBrick.TextValue = "";
                        }
                    }
                }
            }
        }
        private void CreateIcons()
        {
            graph.DefaultBrickStyle.BackColor   = Color.Transparent;
            graph.DefaultBrickStyle.BorderColor = Color.Black;
            graph.DefaultBrickStyle.Sides       = BorderSide.None;
            Size imageSize = Size.Empty;

            if (offsetx != 0)
            {
                for (int i = 0; i < Items.Count; i++)
                {
                    ListViewItem item  = Items[i];
                    int          index = item.ImageIndex;
                    Image        image = imageList.Images[index];

                    Rectangle r = item.Bounds;
                    imageSize = imageList.ImageSize;
                    r.Size    = imageSize;

                    if (index < 0)
                    {
                        DrawBrick("VisualBrick", r);
                    }
                    else
                    {
                        ImageBrick brick = (ImageBrick)DrawBrick("ImageBrick", r);
                        brick.Image = image;
                    }
                }
                offsetx += 3;
            }

            graph.DefaultBrickStyle.StringFormat = new BrickStringFormat(StringFormatFlags.LineLimit,
                                                                         StringAlignment.Near, StringAlignment.Near);

            for (int i = 0; i < Items.Count; i++)
            {
                ListViewItem item = Items[i];
                graph.DefaultBrickStyle.Font      = item.Font;
                graph.DefaultBrickStyle.BackColor = (item.BackColor == SystemColors.Window)
                    ? Color.Transparent : item.BackColor;
                graph.DefaultBrickStyle.ForeColor = item.ForeColor;

                RectangleF r = RectangleF.Empty;
                r.Size = MeasureString(item.Text);
                if (r.Width > 59)
                {
                    r.Width  = 59;
                    r.Height = 29;
                }

                r.X = item.Bounds.Left;
                if (item.Bounds.Width > item.Bounds.Height)
                {
                    r.X += imageSize.Width;
                }
                r.Y = item.Bounds.Bottom - r.Height;
                TextBrick brick = (TextBrick)DrawBrick("TextBrick", r);
                brick.Text = item.Text;
            }
        }