Exemplo n.º 1
0
        //	http://www.mikesdotnetting.com/Article/88/iTextSharp-Drawing-shapes-and-Graphics

        public override void CreatePath(iTextSharp.text.pdf.PdfContentByte contentByte,
                                        BaseLine line,
                                        IBaseStyleDecorator style,
                                        iTextSharp.text.Rectangle rectangle)
        {
            if (contentByte == null)
            {
                throw new ArgumentNullException("contentByte");
            }

            if (style == null)
            {
                throw new ArgumentNullException("style");
            }
            if (rectangle == null)
            {
                throw new ArgumentNullException("rectangle");
            }

            if (line == null)
            {
                BaseShape.FillBackGround(contentByte, style, rectangle);
            }
            else
            {
                BaseShape.SetupShape(contentByte, style);
                contentByte.SetLineWidth(UnitConverter.FromPixel(line.Thickness).Point);
                contentByte.RoundRectangle(rectangle.Left, rectangle.Bottom, rectangle.Width, rectangle.Height, CornerRadius);
                BaseShape.FinishShape(contentByte);
            }
        }
Exemplo n.º 2
0
        public void DrawBorder(iTextSharp.text.pdf.PdfContentByte contentByte,
                               iTextSharp.text.Rectangle rectangle,
                               ICSharpCode.Reports.Core.Exporter.IBaseStyleDecorator style)
        {
            if (contentByte == null)
            {
                throw new ArgumentNullException("contentByte");
            }

            contentByte.SetColorStroke(style.PdfFrameColor);
            contentByte.SetLineWidth(UnitConverter.FromPixel(baseline.Thickness).Point);

            contentByte.MoveTo(rectangle.Left, rectangle.Top);

            contentByte.LineTo(rectangle.Left, rectangle.Top - rectangle.Height);

            contentByte.LineTo(rectangle.Left + rectangle.Width, rectangle.Top - rectangle.Height);

            contentByte.LineTo(rectangle.Left + rectangle.Width, rectangle.Top);

            contentByte.LineTo(rectangle.Left, rectangle.Top);

            contentByte.FillStroke();
            contentByte.ResetRGBColorFill();
        }
Exemplo n.º 3
0
        public override void CreatePath(iTextSharp.text.pdf.PdfContentByte contentByte,
                                        BaseLine line,
                                        IBaseStyleDecorator style,
                                        iTextSharp.text.Rectangle rectangle)
        {
            if (contentByte == null)
            {
                throw new ArgumentNullException("contentByte");
            }
            if (rectangle == null)
            {
                throw new ArgumentNullException("rectangle");
            }

            if ((line == null) || (line.Thickness < 1))
            {
                BaseShape.FillBackGround(contentByte, style, rectangle);
            }
            else if ((style.BackColor == GlobalValues.DefaultBackColor))
            {
                BaseShape.SetupShape(contentByte, style);
                contentByte.SetLineWidth(UnitConverter.FromPixel(line.Thickness).Point);
                contentByte.Ellipse(rectangle.Left,
                                    rectangle.Top,
                                    rectangle.Left + rectangle.Width,
                                    rectangle.Top - rectangle.Height);
                BaseShape.FinishShape(contentByte);
            }
            else
            {
                BaseShape.FillBackGround(contentByte, style, rectangle);
            }
        }
Exemplo n.º 4
0
        public override void CreatePath(iTextSharp.text.pdf.PdfContentByte contentByte,
                                        BaseLine line,
                                        IBaseStyleDecorator style,
                                        Point from, Point to)
        {
            if (contentByte == null)
            {
                throw new ArgumentNullException("contentByte");
            }

            BaseShape.SetupShape(contentByte, style);
            contentByte.SetLineWidth(UnitConverter.FromPixel(line.Thickness).Point);
            contentByte.MoveTo(from.X, from.Y);
            contentByte.LineTo(to.X, to.Y);
            BaseShape.FinishShape(contentByte);
        }
Exemplo n.º 5
0
        public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            System.Drawing.Rectangle r = (System.Drawing.Rectangle)value;

            float lx = (float)UnitConverter.FromPixel(r.Left).Point;
            float ly = (float)this.converter.PageTop - UnitConverter.FromPixel(r.Bottom).Point;
            float rx = (float)lx + UnitConverter.FromPixel(r.Width).Point;
            float ry = (float)ly + UnitConverter.FromPixel(r.Height).Point;

            return(new iTextSharp.text.Rectangle(lx, ly, rx, ry));
        }