예제 #1
0
        public override void DrawBarcode(IGraphicsRenderer g, RectangleF displayRect)
        {
            float width  = angle == 90 || angle == 270 ? displayRect.Height : displayRect.Width;
            float height = angle == 90 || angle == 270 ? displayRect.Width : displayRect.Height;
            IGraphicsRendererState state = g.Save();

            try
            {
                // rotate
                g.TranslateTransform(displayRect.Left, displayRect.Top);
                g.RotateTransform(angle);

                switch (angle)
                {
                case 90:
                    g.TranslateTransform(0, -displayRect.Width);
                    break;

                case 180:
                    g.TranslateTransform(-displayRect.Width, -displayRect.Height);
                    break;

                case 270:
                    g.TranslateTransform(-displayRect.Height, 0);
                    break;
                }

                DrawBarcode(g, width, height);
            }
            finally
            {
                g.Restore(state);
            }
        }
예제 #2
0
        internal override void DrawBarcode(IGraphicsRenderer g, RectangleF displayRect)
        {
            float originalWidth = CalcBounds().Width / 1.25f;
            float width         = angle == 90 || angle == 270 ? displayRect.Height : displayRect.Width;
            float height        = angle == 90 || angle == 270 ? displayRect.Width : displayRect.Height;

            zoom           = width / originalWidth;
            barArea.Height = height / zoom;
            if (showText)
            {
                barArea.Height -= 14;
                if (textUp)
                {
                    barArea.Y = 14;
                }
            }
            drawArea.Height = height / zoom;

            IGraphicsRendererState state = g.Save();

            try
            {
                // rotate
                g.TranslateTransform(displayRect.Left, displayRect.Top);
                g.RotateTransform(angle);
                switch (angle)
                {
                case 90:
                    g.TranslateTransform(0, -displayRect.Width);
                    break;

                case 180:
                    g.TranslateTransform(-displayRect.Width, -displayRect.Height);
                    break;

                case 270:
                    g.TranslateTransform(-displayRect.Height, 0);
                    break;
                }

                g.TranslateTransform(barArea.Left * zoom, 0);
                DoLines(pattern, g, zoom);
                if (showText)
                {
                    DrawText(g, text);
                }
            }
            finally
            {
                g.Restore(state);
            }
        }