void IBasePrintable.CreateArea(string areaName, IBrickGraphics graph)
        {
            if (areaName != "Detail")
            {
                return;
            }
            int width;
            int height;

            if (paged)
            {
                width  = viewer.Width;
                height = viewer.Height;
            }
            else
            {
                width  = Convert.ToInt32(ps.PageSettings.UsablePageSizeInPixels.Width);
                height = Convert.ToInt32(ps.PageSettings.UsablePageSizeInPixels.Height);
            }
            Image bitmap =
                XRControlPaint.GetControlImage(
                    viewer,
                    WinControlDrawMethod_Utils.UseWMPrintRecursive,
                    WinControlImageType_Utils.Bitmap);

            graph.DrawBrick(new ImageBrick()
            {
                Image    = bitmap,
                SizeMode = ImageSizeMode.CenterImage
            }, new Rectangle(0, 0, width, height));
        }
예제 #2
0
        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);
        }
예제 #3
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
         }
     }
 }
예제 #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;
            }
        }
 private void button2_Click(object sender, EventArgs e)
 {
     #region #UsingEllipseBrick
     Brick brick = new EllipseBrick(Color.LightGreen, Color.Blue,
                                    LinearGradientMode.ForwardDiagonal);
     printingSystem1.Begin();
     IBrickGraphics graph = printingSystem1.Graph;
     // Specify the page area to draw a brick.
     printingSystem1.Graph.Modifier = BrickModifier.Detail;
     // Add the brick with specified dimensions to the document.
     graph.DrawBrick(brick, new RectangleF(0, 0, 150, 100));
     printingSystem1.End();
     printingSystem1.PreviewFormEx.Show();
     #endregion
 }
예제 #6
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;
        }
예제 #7
0
        private void CreateClickAreaForPieChart(string areaName, IBrickGraphics graph)
        {
            if (this.RootGroupInfo.GroupResults == null)
            {
                return;
            }

            int count = this.RootGroupInfo.GroupResults.Count;

            WebbTableCell m_cell = null;

            TextBrick m_brick = null;

            Rectangle rcClient = new Rectangle(new Point(0, 0), new Size(this.ControlWidth, this.ControlHeight));

            rcClient.Offset(this.PrintingTable.Offset.Width, this.PrintingTable.Offset.Height);

            int offset = 2;

            Size sizeLengend = new Size(60, 15);

            Point location = new Point((int)(rcClient.Right - offset - sizeLengend.Width), rcClient.Top + offset);

            Rectangle rectLengend = new Rectangle(location, sizeLengend);

            for (int index = 0; index < count; index++)
            {
                m_cell = this.PrintingTable.GetCell(0, index + 1) as WebbTableCell;

                m_brick = m_cell.CreateTextBrick();

                if (m_cell.ClickEventArg != null)
                {
                    m_brick.MouseDown += new MouseEventHandler(Webb.Reports.DataProvider.VideoPlayBackManager.OnBrickDown);
                    m_brick.MouseUp   += new MouseEventHandler(Webb.Reports.DataProvider.VideoPlayBackManager.OnBrickUp);
                    m_brick.OnClick   += new EventHandler(m_cell.ClickHandler);
                    m_brick.Url        = "http://www.webbelectronics.com/";
                }

                graph.DrawBrick(m_brick, RectangleF.FromLTRB(rectLengend.Left, rectLengend.Top, rectLengend.Right, rectLengend.Bottom));

                rectLengend.Offset(0, sizeLengend.Height);
            }
        }
예제 #8
0
        public void CreateClickAreas(IBrickGraphics graph)            //Added this function at 2008-11-11 14:50:04@Simon
        {
            if (this._ClickAreas == null || this._ClickAreas.Count <= 0)
            {
                return;
            }

            int clickcount = this._ClickAreas.Count;

            if (clickcount > this.PrintingTable.GetColumns() - 1)
            {
                return;
            }

            for (int col = 0; col < clickcount; col++)
            {
                WebbTableCell m_cell = PrintingTable.GetCell(0, col + 1) as WebbTableCell;

                RectangleF rectF = (RectangleF)this._ClickAreas[col];

                if (rectF == RectangleF.Empty || rectF.Width * rectF.Height <= 0)
                {
                    continue;
                }

                TextBrick m_brick = m_cell.CreateTextBrick();

                if (m_cell.ClickEventArg != null)
                {
                    m_brick.MouseDown += new MouseEventHandler(Webb.Reports.DataProvider.VideoPlayBackManager.OnBrickDown);
                    m_brick.MouseUp   += new MouseEventHandler(Webb.Reports.DataProvider.VideoPlayBackManager.OnBrickUp);
                    m_brick.OnClick   += new EventHandler(m_cell.ClickHandler);
                    m_brick.Url        = "http://www.webbelectronics.com/";

                    rectF.Offset(PrintingTable.Offset.Width, PrintingTable.Offset.Height);
                    graph.DrawBrick(m_brick, rectF);
                }
            }
        }
예제 #9
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);
        }
        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 IBrick DrawBrick(string typeName, RectangleF rect)
        {
            IBrick brick = ps.CreateBrick(typeName);

            return(graph.DrawBrick(brick, rect));
        }
예제 #12
0
        private void CreateClickAreaForBarChart(string areaName, IBrickGraphics graph)
        {
            //Draw Transparent Bars Brick
            WebbTableCell m_cell = null;

            TextBrick m_brick = null;

            int m_row = 0, m_col = 0;

            Rectangle rect = this.GetChartRect(new Rectangle(new Point(0, 0), new Size(this.ControlWidth, this.ControlHeight)), this.AppearanceType);

            GroupSummaryCollection summaries = new GroupSummaryCollection();

            GetAllSummaries(this._RootGroupInfo, ref summaries);

            int nColumns = this.GetColumns();

            double maxValue = this.GetMaxValue();

            double ratio = rect.Height / maxValue / 1.2;

            double groupWidth = (double)rect.Width / nColumns;

            double barWidth = groupWidth / this._Series.Count * 0.8;

            double offset = 0, height = 0;

            string value = string.Empty;

            for (m_col = 1; m_col < this.PrintingTable.GetColumns(); m_col++)
            {
                try
                {
                    height = Convert.ToDouble(summaries[m_col - 1].Value) * ratio;

                    value = summaries[m_col - 1].Value.ToString();
                }
                catch
                {
                    height = 0;
                }

                int nSeriesID = summaries[m_col - 1].SummaryID % this._Series.Count;

                if (nSeriesID == 0)
                {
                    offset += groupWidth * 0.1;
                }

                Brush brush = new SolidBrush(this._Series[nSeriesID].BackColor);

                Pen penBorder = new Pen(this._Series[nSeriesID].BorderColor);

                Color clrText = this._Series[nSeriesID].TextColor;

                RectangleF rectF = RectangleF.Empty;

                if (height < 0)
                {
                    rectF = new RectangleF(new PointF((float)(rect.Left + offset), rect.Bottom), new SizeF((float)barWidth, (float)(-1 * height)));
                }
                else
                {
                    rectF = new RectangleF(new PointF((float)(rect.Left + offset), rect.Bottom - (float)height), new SizeF((float)barWidth, (float)height));
                }

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

                m_brick = m_cell.CreateTextBrick();

                if (m_cell.ClickEventArg != null)
                {
                    m_brick.MouseDown += new MouseEventHandler(Webb.Reports.DataProvider.VideoPlayBackManager.OnBrickDown);
                    m_brick.MouseUp   += new MouseEventHandler(Webb.Reports.DataProvider.VideoPlayBackManager.OnBrickUp);
                    m_brick.OnClick   += new EventHandler(m_cell.ClickHandler);
                    m_brick.Url        = "http://www.webbelectronics.com/";
                }

                rectF.Offset(this.PrintingTable.Offset.Width, this.PrintingTable.Offset.Height);

                graph.DrawBrick(m_brick, rectF);

                if (nSeriesID == this._Series.Count - 1)
                {
                    offset += groupWidth * 0.1;
                }

                offset += barWidth;
            }
        }