コード例 #1
0
        /// <summary>
        /// Demonstrates serveral bar code types.
        /// </summary>
        public override void RenderPage(XGraphics gfx)
        {
            base.RenderPage(gfx);

            XFont  font = new XFont("Verdana", 14, XFontStyle.Bold);
            string info = "DataMatrix is a fake in the Open Source version!";
            XSize  size = gfx.MeasureString(info, font);

            gfx.DrawString(info, font, XBrushes.Firebrick, (600 - size.Width) / 2, 50);


            //Graphics grfx = gfx.Internals.Graphics;

            CodeDataMatrix dm = new CodeDataMatrix("test", 26);

            dm.Size = new XSize(XUnit.FromMillimeter(15), XUnit.FromMillimeter(15));
            gfx.DrawMatrixCode(dm, XBrushes.DarkBlue, new XPoint(100, 100));

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

            dm      = new CodeDataMatrix("test", 16, 48);
            dm.Size = new XSize(XUnit.FromMillimeter(50), XUnit.FromMillimeter(18));
            gfx.DrawMatrixCode(dm, XBrushes.DarkBlue, new XPoint(500, 100));

            dm      = new CodeDataMatrix("0123456789", 52);
            dm.Size = new XSize(XUnit.FromMillimeter(30), XUnit.FromMillimeter(30));
            gfx.DrawMatrixCode(dm, XBrushes.DarkBlue, new XPoint(100, 300));

            dm           = new CodeDataMatrix("0123456789", 12, 26);
            dm.Direction = CodeDirection.TopToBottom;
            dm.Size      = new XSize(XUnit.FromMillimeter(14), XUnit.FromMillimeter(7));
            gfx.DrawMatrixCode(dm, XBrushes.DarkBlue, new XPoint(300, 300));

            dm      = new CodeDataMatrix("0123456789", 96);
            dm.Size = new XSize(XUnit.FromMillimeter(30), XUnit.FromMillimeter(30));
            gfx.DrawMatrixCode(dm, XBrushes.DarkBlue, new XPoint(500, 300));

            dm           = new CodeDataMatrix("www.empira.de", 20);
            dm.Direction = CodeDirection.BottomToTop;
            dm.Size      = new XSize(XUnit.FromMillimeter(7), XUnit.FromMillimeter(7));
            gfx.DrawMatrixCode(dm, XBrushes.DarkBlue, new XPoint(100, 500));

            dm      = new CodeDataMatrix("www.empira.de", 144, 144, 2);
            dm.Size = new XSize(XUnit.FromMillimeter(50), XUnit.FromMillimeter(50));
            gfx.DrawMatrixCode(dm, XBrushes.DarkBlue, new XPoint(300, 500));

            dm           = new CodeDataMatrix("www.empira.de", 88);
            dm.Direction = CodeDirection.RightToLeft;
            dm.Size      = new XSize(XUnit.FromMillimeter(15), XUnit.FromMillimeter(15));
            gfx.DrawMatrixCode(dm, XBrushes.DarkBlue, new XPoint(500, 500));
        }
コード例 #2
0
        /// <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));
        }