Ejemplo n.º 1
0
        internal override void Render()
        {
            RenderFilling();

            BarcodeFormatInfo formatInfo = (BarcodeFormatInfo)_renderInfo.FormatInfo;
            Area  contentArea            = _renderInfo.LayoutInfo.ContentArea;
            XRect destRect = new XRect(contentArea.X, contentArea.Y, formatInfo.Width, formatInfo.Height);

            BarCode gfxBarcode = null;

            if (_barcode.Type == BarcodeType.Barcode39)
            {
                gfxBarcode = new Code3of9Standard(_barcode.Code);
            }
            else if (_barcode.Type == BarcodeType.Barcode25i)
            {
                gfxBarcode = new Code2of5Interleaved(_barcode.Code);
            }

            // if gfxBarcode is null, the barcode type is not supported
            if (gfxBarcode != null)
            {
                gfxBarcode.Direction = CodeDirection.LeftToRight;
                gfxBarcode.Size      = new XSize(ShapeWidth, ShapeHeight);

                _gfx.DrawBarCode(gfxBarcode, XBrushes.Black, destRect.Location);
            }

            RenderLine();
        }
Ejemplo n.º 2
0
        private void PrintBarCode(
            XGraphics gfx,
            int currentXPos,
            int currentYPos,
            PrintItem printItem)
        {
            Code3of9Standard barCode = new Code3of9Standard(printItem.Code, new XSize(CodeWidth, CodeHeight));

            barCode.TextLocation = TextLocation.Below;
            barCode.Anchor       = AnchorType.BottomLeft;
            gfx.DrawBarCode(barCode, new XPoint(currentXPos, currentYPos));
        }
Ejemplo n.º 3
0
        internal override void Render()
        {
            RenderFilling();

            BarcodeFormatInfo formatInfo = (BarcodeFormatInfo)this.renderInfo.FormatInfo;
            Area  contentArea            = this.renderInfo.LayoutInfo.ContentArea;
            XRect destRect = new XRect(contentArea.X, contentArea.Y, formatInfo.Width, formatInfo.Height);

            BarCode gfxBarcode = null;

            switch (this.barcode.Type)
            {
            case BarcodeType.Barcode128:
                gfxBarcode = new Code128();
                break;

            case BarcodeType.Barcode25i:
                gfxBarcode = new Code2of5Interleaved();
                break;

            case BarcodeType.Barcode39:
                gfxBarcode = new Code3of9Standard();
                break;

            case BarcodeType.BarcodeEan13:
                gfxBarcode = new Ean13();
                break;

            default:
                break;
            }

            // if gfxBarcode is null, the barcode type is not supported
            if (gfxBarcode != null)
            {
                if (barcode.Text)
                {
                    gfxBarcode.TextLocation = TextLocation.BelowEmbedded;
                }
                gfxBarcode.Text      = this.barcode.Code;
                gfxBarcode.Direction = CodeDirection.LeftToRight;
                gfxBarcode.Size      = new XSize(ShapeWidth, ShapeHeight);
                this.gfx.DrawBarCode(gfxBarcode, XBrushes.Black, destRect.Location);
            }

            RenderLine();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Draws the voter id as a barcode and a human readable string
        /// </summary>
        /// <param name="gfx">XGraphics object</param>
        /// <param name="votingNumber">The unique voter id </param>
        private void Barcode(XGraphics gfx, string votingNumber)
        {
            //The barcode type
            BarCode barcode = new Code3of9Standard();

            barcode.Text = votingNumber;

            //Indicator to the barcode scanner where the barcode starts and ends
            barcode.StartChar = '*';
            barcode.EndChar   = '*';

            //Draws the voter id as a barcode
            barcode.Size = (XSize)(new XPoint(120, 20));
            gfx.DrawBarCode(barcode, XBrushes.Black, new XPoint(310, 40));

            //Draws the voter id as a string
            XFont font = new XFont("Lucida Console", 7, XFontStyle.Regular);

            gfx.DrawString(votingNumber, font, XBrushes.Black, 310, 35);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Demonstrates the use of barcodes.
        /// </summary>
        public override void RenderPage(XGraphics gfx)
        {
            base.RenderPage(gfx);

            Graphics grfx = gfx.Internals.Graphics;

            Code2of5Interleaved bc25 = new Code2of5Interleaved();

            bc25.Text = "123456";
            bc25.Size = new XSize(90, 30);
            //bc25.Direction = CodeDirection.RightToLeft;
            bc25.TextLocation = TextLocation.Above;
            gfx.DrawBarCode(bc25, XBrushes.DarkBlue, new XPoint(100, 100));

            bc25.Direction = CodeDirection.RightToLeft;
            gfx.DrawBarCode(bc25, XBrushes.DarkBlue, new XPoint(300, 100));

            bc25.Direction = CodeDirection.TopToBottom;
            gfx.DrawBarCode(bc25, XBrushes.DarkBlue, new XPoint(100, 300));

            bc25.Direction = CodeDirection.BottomToTop;
            gfx.DrawBarCode(bc25, XBrushes.Red, new XPoint(300, 300));

            Code3of9Standard bc39 = new Code3of9Standard("ISABEL123", new XSize(90, 40));

            bc39.TextLocation = TextLocation.AboveEmbedded;
            gfx.DrawBarCode(bc39, XBrushes.DarkBlue, new XPoint(100, 500));

            bc39.Direction = CodeDirection.RightToLeft;
            gfx.DrawBarCode(bc39, XBrushes.DarkBlue, new XPoint(300, 500));

            bc39.Text      = "TITUS";
            bc39.Direction = CodeDirection.TopToBottom;
            gfx.DrawBarCode(bc39, XBrushes.DarkBlue, new XPoint(100, 700));

            bc39.Direction = CodeDirection.BottomToTop;
            gfx.DrawBarCode(bc39, XBrushes.Red, new XPoint(300, 700));
        }