Exemple #1
0
        private void DoInstructions(Single recX, Single recY, Single recWidth, Single recHeight, Pen p)
        {
            BorderStyleEnum ls = getLineStyle(p);

            switch (p.Brush.GetType().Name)
            {
            case "SolidBrush":
                System.Drawing.SolidBrush theBrush = (System.Drawing.SolidBrush)p.Brush;
                PageRectangle             pl       = new PageRectangle();
                pl.X = X + recX * SCALEFACTOR;
                pl.Y = Y + recY * SCALEFACTOR;
                pl.W = recWidth * SCALEFACTOR;
                pl.H = recHeight * SCALEFACTOR;

                StyleInfo SI = new StyleInfo();
                SI.Color     = theBrush.Color;
                SI.BColorTop = SI.BColorBottom = SI.BColorLeft = SI.BColorRight = theBrush.Color;
                SI.BStyleTop = SI.BStyleBottom = SI.BStyleLeft = SI.BStyleRight = ls;
                SI.BWidthTop = SI.BWidthBottom = SI.BWidthLeft = SI.BWidthRight = p.Width * SCALEFACTOR;
                pl.SI        = SI;
                items.Add(pl);
                break;

            default:
                break;
            }
        }
        public List<PageItem> Process(int Flags, byte[] RecordData)
        {
            MemoryStream _ms = null;
            BinaryReader _br = null;
            try
            {
                _ms = new MemoryStream(RecordData);
                _br = new BinaryReader(_ms);

                Byte[] PrivateData = _br.ReadBytes(RecordData.Length);
                //Ok we should have our private data which I am storing my tooltip value in...
                //now lets interpret it...
                string PData = new System.Text.ASCIIEncoding().GetString(PrivateData);
                //If string starts with "ToolTip" then lets do something with it.. otherwise I don't care about it.
                if (PData.StartsWith("ToolTip"))
                {
                    PageRectangle pr = new PageRectangle();
                    StyleInfo si = new StyleInfo();
                    pr.SI = si;
                    //si.BackgroundColor = Color.Blue;// Just a test to see where the tooltip is being drawn
                    string[] ttd = PData.Split('|');
                    pr.Tooltip = ttd[0].Split(':')[1];
                    pr.X = X + Single.Parse(ttd[1].Split(':')[1]) * SCALEFACTOR;
                    pr.Y = Y + Single.Parse(ttd[2].Split(':')[1]) * SCALEFACTOR;
                    pr.W = Single.Parse(ttd[3].Split(':')[1]) * SCALEFACTOR;
                    pr.H = Single.Parse(ttd[4].Split(':')[1]) * SCALEFACTOR;
                    items.Add(pr);
                }
                else if (PData.StartsWith("PolyToolTip"))
                {
                    PagePolygon pp = new PagePolygon();
                    StyleInfo si = new StyleInfo();
                    pp.SI = si;
                    //si.BackgroundColor = Color.Blue;// Just a test to see where the tooltip is being drawn
                    string[] ttd = PData.Split('|');
                    PointF[] pts = new PointF[(ttd.Length - 1) / 2];
                    pp.Points = pts;
                    pp.Tooltip = ttd[0].Split(':')[1];
                    for (int i = 0; i < pts.Length; i++)
                    {
                        pts[i].X = X + Single.Parse(ttd[i*2 +1]) * SCALEFACTOR;
                        pts[i].Y = Y + Single.Parse(ttd[i*2 +2]) * SCALEFACTOR;
                    }
                    items.Add(pp);
                }
                return items;
            }

            finally
            {
                if (_br != null)
                    _br.Close();
                if (_ms != null)
                    _ms.Dispose();

            }
        }
Exemple #3
0
        override internal void RunPage(Pages pgs, Row row)
        {
            Report r       = pgs.Report;
            bool   bHidden = IsHidden(r, row);

            SetPagePositionBegin(pgs);

            // Handle page breaking at start
            if (this.PageBreakAtStart && !IsTableOrMatrixCell(r) && !pgs.CurrentPage.IsEmpty() && !bHidden)
            {   // force page break at beginning of dataregion
                pgs.NextOrNew();
                pgs.CurrentPage.YOffset = OwnerReport.TopOfPage;
            }

            PageRectangle pr = new PageRectangle();

            SetPagePositionAndStyle(r, pr, row);
            if (pr.SI.BackgroundImage != null)
            {
                pr.SI.BackgroundImage.H = pr.H;                         //   and in the background image
            }
            if (!bHidden)
            {
                Page p = pgs.CurrentPage;
                p.AddObject(pr);

                if (_ReportItems != null)
                {
                    float saveY = p.YOffset;
                    //             p.YOffset += (Top == null ? 0 : this.Top.Points);
                    p.YOffset = pr.Y;       // top of rectangle is base for contained report items
                    _ReportItems.RunPage(pgs, row, GetOffsetCalc(pgs.Report) + LeftCalc(r));
                    p.YOffset = saveY;
                }

                // Handle page breaking at end
                if (this.PageBreakAtEnd && !IsTableOrMatrixCell(r) && !pgs.CurrentPage.IsEmpty())
                {       // force page break at beginning of dataregion
                    pgs.NextOrNew();
                    pgs.CurrentPage.YOffset = OwnerReport.TopOfPage;
                }
            }
//			SetPagePositionEnd(pgs, pgs.CurrentPage.YOffset);
            SetPagePositionEnd(pgs, pr.Y + pr.H);
        }
Exemple #4
0
        private void DoInstructions(Single recX, Single recY, Single recWidth, Single recHeight, Brush b)
        {
            PageRectangle pl = new PageRectangle();
            StyleInfo     SI = new StyleInfo();

            pl.X = X + recX * SCALEFACTOR;
            pl.Y = Y + recY * SCALEFACTOR;
            pl.W = recWidth * SCALEFACTOR;
            pl.H = recHeight * SCALEFACTOR;

            switch (b.GetType().Name)
            {
            case "SolidBrush":
                System.Drawing.SolidBrush theBrush = (System.Drawing.SolidBrush)b;
                SI.Color           = theBrush.Color;
                SI.BackgroundColor = theBrush.Color;
                break;

            case "LinearGradientBrush":
                System.Drawing.Drawing2D.LinearGradientBrush linBrush = (System.Drawing.Drawing2D.LinearGradientBrush)b;
                SI.BackgroundGradientType     = BackgroundGradientTypeEnum.LeftRight;
                SI.BackgroundColor            = linBrush.LinearColors[0];
                SI.BackgroundGradientEndColor = linBrush.LinearColors[1];
                break;

            case "HatchBrush":
                System.Drawing.Drawing2D.HatchBrush hatBrush = (System.Drawing.Drawing2D.HatchBrush)b;
                SI.BackgroundColor = hatBrush.BackgroundColor;
                SI.Color           = hatBrush.ForegroundColor;
                SI.PatternType     = StyleInfo.GetPatternType(hatBrush.HatchStyle);
                break;

            default:
                break;
            }

            pl.SI = SI;
            items.Add(pl);
        }
Exemple #5
0
        public List <PageItem> Process(int Flags, byte[] RecordData)
        {
            MemoryStream _ms = null;
            BinaryReader _br = null;

            try
            {
                _ms = new MemoryStream(RecordData);
                _br = new BinaryReader(_ms);

                Byte[] PrivateData = _br.ReadBytes(RecordData.Length);
                //Ok we should have our private data which I am storing my tooltip value in...
                //now lets interpret it...
                string PData = new System.Text.ASCIIEncoding().GetString(PrivateData);
                //If string starts with "ToolTip" then lets do something with it.. otherwise I don't care about it.
                if (PData.StartsWith("ToolTip"))
                {
                    PageRectangle pr = new PageRectangle();
                    StyleInfo     si = new StyleInfo();
                    pr.SI = si;
                    //si.BackgroundColor = Color.Blue;// Just a test to see where the tooltip is being drawn
                    string[] ttd = PData.Split('|');
                    pr.Tooltip = ttd[0].Split(':')[1];
                    pr.X       = X + Single.Parse(ttd[1].Split(':')[1]) * SCALEFACTOR;
                    pr.Y       = Y + Single.Parse(ttd[2].Split(':')[1]) * SCALEFACTOR;
                    pr.W       = Single.Parse(ttd[3].Split(':')[1]) * SCALEFACTOR;
                    pr.H       = Single.Parse(ttd[4].Split(':')[1]) * SCALEFACTOR;
                    items.Add(pr);
                }
                else if (PData.StartsWith("PolyToolTip"))
                {
                    PagePolygon pp = new PagePolygon();
                    StyleInfo   si = new StyleInfo();
                    pp.SI = si;
                    //si.BackgroundColor = Color.Blue;// Just a test to see where the tooltip is being drawn
                    string[] ttd = PData.Split('|');
                    PointF[] pts = new PointF[(ttd.Length - 1) / 2];
                    pp.Points  = pts;
                    pp.Tooltip = ttd[0].Split(':')[1];
                    for (int i = 0; i < pts.Length; i++)
                    {
                        pts[i].X = X + Single.Parse(ttd[i * 2 + 1]) * SCALEFACTOR;
                        pts[i].Y = Y + Single.Parse(ttd[i * 2 + 2]) * SCALEFACTOR;
                    }
                    items.Add(pp);
                }
                return(items);
            }

            finally
            {
                if (_br != null)
                {
                    _br.Close();
                }
                if (_ms != null)
                {
                    _ms.Dispose();
                }
            }
        }
Exemple #6
0
        /// <summary>
        /// Render all the objects in a page
        /// </summary>
        private void processPage(Pages pages, IEnumerable page)
        {
            //loop thru the items in the page
            foreach (PageItem pageItem in page)
            {
                if (pageItem.SI.BackgroundImage != null)
                {
                    //put out any background image
                    PageImage backgroundImage = pageItem.SI.BackgroundImage;

                    float imageWidth  = RSize.PointsFromPixels(pages.G, backgroundImage.SamplesW);
                    float imageHeight = RSize.PointsFromPixels(pages.G, backgroundImage.SamplesH);
                    int   repeatX     = 0;
                    int   repeatY     = 0;
                    float itemWidth   = pageItem.W - (pageItem.SI.PaddingLeft + pageItem.SI.PaddingRight);
                    float itemHeight  = pageItem.H - (pageItem.SI.PaddingTop + pageItem.SI.PaddingBottom);

                    switch (backgroundImage.Repeat)
                    {
                    case ImageRepeat.Repeat:
                        repeatX = (int)Math.Floor(itemWidth / imageWidth);
                        repeatY = (int)Math.Floor(itemHeight / imageHeight);
                        break;

                    case ImageRepeat.RepeatX:
                        repeatX = (int)Math.Floor(itemWidth / imageWidth);
                        repeatY = 1;
                        break;

                    case ImageRepeat.RepeatY:
                        repeatY = (int)Math.Floor(itemHeight / imageHeight);
                        repeatX = 1;
                        break;

                    case ImageRepeat.NoRepeat:
                    default:
                        repeatX = repeatY = 1;
                        break;
                    }

                    //make sure the image is drawn at least 1 times
                    repeatX = Math.Max(repeatX, 1);
                    repeatY = Math.Max(repeatY, 1);

                    float currX  = pageItem.X + pageItem.SI.PaddingLeft;
                    float currY  = pageItem.Y + pageItem.SI.PaddingTop;
                    float startX = currX;
                    float startY = currY;
                    for (int i = 0; i < repeatX; i++)
                    {
                        for (int j = 0; j < repeatY; j++)
                        {
                            currX = startX + i * imageWidth;
                            currY = startY + j * imageHeight;

                            addImage(backgroundImage.SI, currX, currY, imageWidth, imageHeight, RectangleF.Empty,
                                     backgroundImage.ImageData, null, pageItem.Tooltip);
                        }
                    }
                }
                else if (pageItem is PageTextHtml)
                {
                    PageTextHtml pageTextHtml = pageItem as PageTextHtml;
                    pageTextHtml.Build(pages.G);
                    processPage(pages, pageTextHtml);
                    continue;
                }
                else if (pageItem is PageText)
                {
                    PageText pageText = pageItem as PageText;
                    float[]  textwidth;
                    string[] measureStrings = RenderUtility.MeasureString(pageText, pages.G, out textwidth);
                    addText(pageText.X, pageText.Y, pageText.W, pageText.H, measureStrings, pageText.SI, textwidth, pageText.CanGrow, pageText.HyperLink, pageText.NoClip, pageText.Tooltip);
                    continue;
                }
                else if (pageItem is PageLine)
                {
                    PageLine pageLine = pageItem as PageLine;
                    addLine(pageLine.X, pageLine.Y, pageLine.X2, pageLine.Y2, pageLine.SI);
                    continue;
                }
                else if (pageItem is PageEllipse)
                {
                    PageEllipse pageEllipse = pageItem as PageEllipse;
                    addEllipse(pageEllipse.X, pageEllipse.Y, pageEllipse.W, pageEllipse.H, pageEllipse.SI, pageEllipse.HyperLink);
                    continue;
                }
                else if (pageItem is PageImage)
                {
                    PageImage pageImage = pageItem as PageImage;

                    //Duc Phan added 20 Dec, 2007 to support sized image
                    RectangleF r2 = new RectangleF(pageImage.X + pageImage.SI.PaddingLeft, pageImage.Y + pageImage.SI.PaddingTop,
                                                   pageImage.W - pageImage.SI.PaddingLeft - pageImage.SI.PaddingRight, pageImage.H - pageImage.SI.PaddingTop - pageImage.SI.PaddingBottom);

                    //work rectangle
                    RectangleF adjustedRect;
                    RectangleF clipRect = RectangleF.Empty;
                    switch (pageImage.Sizing)
                    {
                    case ImageSizingEnum.AutoSize:
                        adjustedRect = new RectangleF(r2.Left, r2.Top, r2.Width, r2.Height);
                        break;

                    case ImageSizingEnum.Clip:
                        adjustedRect = new RectangleF(r2.Left, r2.Top, RSize.PointsFromPixels(pages.G, pageImage.SamplesW),
                                                      RSize.PointsFromPixels(pages.G, pageImage.SamplesH));
                        clipRect = new RectangleF(r2.Left, r2.Top, r2.Width, r2.Height);
                        break;

                    case ImageSizingEnum.FitProportional:
                        float height;
                        float width;
                        float ratioIm = (float)pageImage.SamplesH / pageImage.SamplesW;
                        float ratioR  = r2.Height / r2.Width;
                        height = r2.Height;
                        width  = r2.Width;
                        if (ratioIm > ratioR)
                        {
                            //this means the rectangle width must be corrected
                            width = height * (1 / ratioIm);
                        }
                        else if (ratioIm < ratioR)
                        {
                            //this means the rectangle height must be corrected
                            height = width * ratioIm;
                        }
                        adjustedRect = new RectangleF(r2.X, r2.Y, width, height);
                        break;

                    case ImageSizingEnum.Fit:
                    default:
                        adjustedRect = r2;
                        break;
                    }

                    if (pageImage.ImgFormat != System.Drawing.Imaging.ImageFormat.Wmf && pageImage.ImgFormat != System.Drawing.Imaging.ImageFormat.Emf)
                    {
                        addImage(pageImage.SI, adjustedRect.X, adjustedRect.Y, adjustedRect.Width, adjustedRect.Height,
                                 clipRect, pageImage.ImageData, pageImage.HyperLink, pageImage.Tooltip);
                    }
                    continue;
                }
                else if (pageItem is PageRectangle)
                {
                    PageRectangle pageRectangle = pageItem as PageRectangle;
                    addRectangle(pageRectangle.X, pageRectangle.Y, pageRectangle.W, pageRectangle.H, pageItem.SI, pageItem.HyperLink, pageItem.Tooltip);
                    continue;
                }
                else if (pageItem is PagePie)
                {
                    PagePie pagePie = pageItem as PagePie;
                    addPie(pagePie.X, pagePie.Y, pagePie.W, pagePie.H, pageItem.SI, pageItem.HyperLink, pageItem.Tooltip);
                    continue;
                }
                else if (pageItem is PagePolygon)
                {
                    PagePolygon pagePolygon = pageItem as PagePolygon;
                    addPolygon(pagePolygon.Points, pageItem.SI, pageItem.HyperLink);
                    continue;
                }
                else if (pageItem is PageCurve)
                {
                    PageCurve pageCurve = pageItem as PageCurve;
                    addCurve(pageCurve.Points, pageItem.SI);
                    continue;
                }
            }
        }
        private void DoInstructions(Single recX, Single recY, Single recWidth, Single recHeight, Brush b)
        {
            PageRectangle pl = new PageRectangle();
            StyleInfo SI = new StyleInfo();
            pl.X = X + recX * SCALEFACTOR;
            pl.Y = Y + recY * SCALEFACTOR;
            pl.W = recWidth * SCALEFACTOR;
            pl.H = recHeight * SCALEFACTOR;

            switch (b.GetType().Name)
            {
                case "SolidBrush":
                    System.Drawing.SolidBrush theBrush = (System.Drawing.SolidBrush)b;
                    SI.Color = theBrush.Color;
                    SI.BackgroundColor = theBrush.Color;
                    break;
                case "LinearGradientBrush":
                    System.Drawing.Drawing2D.LinearGradientBrush linBrush = (System.Drawing.Drawing2D.LinearGradientBrush)b;
                    SI.BackgroundGradientType = BackgroundGradientTypeEnum.LeftRight;
                    SI.BackgroundColor = linBrush.LinearColors[0];
                    SI.BackgroundGradientEndColor = linBrush.LinearColors[1];
                    break;
                case "HatchBrush":
                    System.Drawing.Drawing2D.HatchBrush hatBrush = (System.Drawing.Drawing2D.HatchBrush) b;
                    SI.BackgroundColor = hatBrush.BackgroundColor;
                    SI.Color = hatBrush.ForegroundColor;
                    SI.PatternType = StyleInfo.GetPatternType(hatBrush.HatchStyle);
                    break;
                default:
                    break;
            }

            pl.SI = SI;
            items.Add(pl);
        }
        internal override void RunPage(Pages pgs, Row row)
        {
            Report r = pgs.Report;
            bool bHidden = IsHidden(r, row);

            SetPagePositionBegin(pgs);

            // Handle page breaking at start
            if (this.PageBreakAtStart && !IsTableOrMatrixCell(r) && !pgs.CurrentPage.IsEmpty() && !bHidden)
            {	// force page break at beginning of dataregion
                pgs.NextOrNew();
                pgs.CurrentPage.YOffset = OwnerReport.TopOfPage;
            }

            PageRectangle pr = new PageRectangle();
            SetPagePositionAndStyle(r, pr, row);
            if (pr.SI.BackgroundImage != null)
                pr.SI.BackgroundImage.H = pr.H;		//   and in the background image

            if (!bHidden)
            {
                Page p = pgs.CurrentPage;
                p.AddObject(pr);

                if (_ReportItems != null)
                {
                    float saveY = p.YOffset;
               //             p.YOffset += (Top == null ? 0 : this.Top.Points);
                    p.YOffset = pr.Y;       // top of rectangle is base for contained report items
                    _ReportItems.RunPage(pgs, row, GetOffsetCalc(pgs.Report) + LeftCalc(r));
                    p.YOffset = saveY;
                }

                // Handle page breaking at end
                if (this.PageBreakAtEnd && !IsTableOrMatrixCell(r) && !pgs.CurrentPage.IsEmpty())
                {	// force page break at beginning of dataregion
                    pgs.NextOrNew();
                    pgs.CurrentPage.YOffset = OwnerReport.TopOfPage;
                }
            }
            //			SetPagePositionEnd(pgs, pgs.CurrentPage.YOffset);
            SetPagePositionEnd(pgs, pr.Y + pr.H);
        }
        private void DoInstructions(Single recX, Single recY, Single recWidth, Single recHeight, Pen p)
        {
            BorderStyleEnum ls = getLineStyle(p);
            switch (p.Brush.GetType().Name)
            {
                case "SolidBrush":
                    System.Drawing.SolidBrush theBrush = (System.Drawing.SolidBrush)p.Brush;
                    PageRectangle pl = new PageRectangle();
                    pl.X = X + recX * SCALEFACTOR;
                    pl.Y = Y + recY * SCALEFACTOR;
                    pl.W = recWidth * SCALEFACTOR;
                    pl.H = recHeight * SCALEFACTOR;

                    StyleInfo SI = new StyleInfo();
                    SI.Color = theBrush.Color;
                    SI.BColorTop = SI.BColorBottom = SI.BColorLeft = SI.BColorRight = theBrush.Color;
                    SI.BStyleTop = SI.BStyleBottom = SI.BStyleLeft = SI.BStyleRight = ls;
                    SI.BWidthTop = SI.BWidthBottom = SI.BWidthLeft = SI.BWidthRight = p.Width * SCALEFACTOR;
                    pl.SI = SI;
                    items.Add(pl);
                    break;
                default:
                    break;
            }
        }