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
        internal override void Format(Area area, FormatInfo previousFormatInfo)
        {
            BarcodeFormatInfo formatInfo = (BarcodeFormatInfo)_renderInfo.FormatInfo;

            formatInfo.Height = _barcode.Height.Point;
            formatInfo.Width  = _barcode.Width.Point;

            base.Format(area, previousFormatInfo);
        }
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();
        }