/// <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));

    }
Example #2
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;

            if (this.barcode.Type == BarcodeType.Barcode39)
                gfxBarcode = new Code3of9Standard();
            else if (this.barcode.Type == BarcodeType.Barcode25i)
                gfxBarcode = new Code2of5Interleaved();

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

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

            RenderLine();
        }
Example #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;
                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();
        }
    /// <summary>
    /// Demonstrates serveral bar code types.
    /// </summary>
    public override void RenderPage(XGraphics gfx)
    {
      XRect rc;
      base.RenderPage(gfx);

      Graphics grfx = gfx.Internals.Graphics;

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

      CodeDataMatrix dm = new CodeDataMatrix("test", 26);
      dm.Size = new XSize(XUnit.FromMillimeter(15), XUnit.FromMillimeter(15));
      gfx.DrawMatrixCode(dm, XBrushes.DarkBlue, new XPoint(300, 100));

      rc = new XRect(30, 200, XUnit.FromCentimeter(9.3) + XUnit.FromMillimeter(0.5), XUnit.FromMillimeter(6));
      gfx.DrawRectangle(new XSolidBrush(XColor.FromArgb(128, XColors.LightSeaGreen)), rc);

      CodeOmr omr = new CodeOmr(0xF8F5FF3F.ToString(), rc.Size, CodeDirection.LeftToRight);
      omr.MakerDistance = XUnit.FromMillimeter(3);
      omr.MakerThickness = XUnit.FromMillimeter(0.5);
      gfx.DrawBarCode(omr, XBrushes.Black, rc.Center);

      omr.Direction = CodeDirection.RightToLeft;
      gfx.DrawBarCode(omr, XBrushes.Black, rc.Center + new XSize(0, 50));

      omr.Direction = CodeDirection.RightToLeft;
      gfx.DrawBarCode(omr, XBrushes.Black, rc.Center + new XSize(0, 50));

      omr.Direction = CodeDirection.TopToBottom;
      gfx.DrawBarCode(omr, XBrushes.Black, rc.Center + new XSize(300, 25));
    }