Esempio n. 1
0
 public BarcodeGenerator(MPrintFormatItem item)
 {
     width         = item.GetMaxWidth();
     height        = item.GetMaxHeight();
     humanReadable = true;
     fontSize      = 12;
     fontName      = "Courier New";
     centered      = false;
 }
Esempio n. 2
0
        }       //	calculateSize

        public override void Paint(Graphics g2D, int pageNo, PointF pageStart, Ctx ctx, bool isView)
        {
            if (m_item == null)
            {
                return;
            }
            //
            System.Drawing.SolidBrush g2Dpen = new System.Drawing.SolidBrush(m_color);
            Pen pen = new Pen(g2Dpen);

            pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
            //
            PointF location = GetAbsoluteLocation(pageStart);
            int    x        = (int)location.X;
            int    y        = (int)location.Y;

            int width  = m_item.GetMaxWidth();
            int height = m_item.GetMaxHeight();

            if (m_item.GetPrintFormatType().Equals(MPrintFormatItem.PRINTFORMATTYPE_Line))
            {
                g2D.DrawLine(pen, x, y, x + width, y + height);
            }
            else
            {
                String type = m_item.GetShapeType();
                if (type == null)
                {
                    type = "";
                }
                if (m_item.IsFilledRectangle())
                {
                    if (type.Equals(MPrintFormatItem.SHAPETYPE_3DRectangle))
                    {
                        g2D.FillRectangle(g2Dpen, x, y, width, height);
                    }
                    else if (type.Equals(MPrintFormatItem.SHAPETYPE_Oval))
                    {
                        g2D.FillEllipse(g2Dpen, x, y, width, height);
                    }
                    else if (type.Equals(MPrintFormatItem.SHAPETYPE_RoundRectangle))
                    {
                        g2D.FillRectangle(g2Dpen, x, y, width, height); //, m_item.getArcDiameter(), m_item.getArcDiameter());
                    }
                    else
                    {
                        g2D.FillRectangle(g2Dpen, x, y, width, height);
                    }
                }
                else
                {
                    if (type.Equals(MPrintFormatItem.SHAPETYPE_3DRectangle))
                    {
                        g2D.DrawRectangle(pen, x, y, width, height);
                    }
                    else if (type.Equals(MPrintFormatItem.SHAPETYPE_Oval))
                    {
                        g2D.DrawEllipse(pen, x, y, width, height);
                    }
                    else if (type.Equals(MPrintFormatItem.SHAPETYPE_RoundRectangle))
                    {
                        g2D.DrawRectangle(pen, x, y, width, height); //, m_item.getArcDiameter(), m_item.getArcDiameter());
                    }
                    else
                    {
                        g2D.DrawRectangle(pen, x, y, width, height);
                    }

                    //PrintElement
                }
            }
        }