public EAN13(string code, string title, Ean13Settings settings) { this.settings = settings; this.code = code; this.title = title; if (!CheckCode(code)) { throw new ArgumentException("Invalid EAN-13 code specified."); } }
private int DrawRightGuard(Ean13Settings settings, Graphics g, int left) { g.FillRectangle(brush, left, top, settings.BarWidth, settings.BarCodeHeight); //1 left += settings.BarWidth; left += settings.BarWidth; //0 g.FillRectangle(brush, left, top, settings.BarWidth, settings.BarCodeHeight); //1 left += settings.BarWidth; return(left); }
private int Draw(Ean13Settings settings, Graphics g, int left, string digit, string s) { int h = (int)(settings.BarCodeHeight * 0.6); g.DrawString(digit, settings.Font, brush, left, h + top); foreach (char c in s) { if (c == '1') { g.FillRectangle(brush, left, top, settings.BarWidth, h); } left += settings.BarWidth; } return(left); }
private int DrawLeftGuard(Ean13Settings settings, Graphics g, string digit, int left) { int h = (int)(settings.BarCodeHeight * 0.6); g.DrawString(digit, settings.Font, brush, left, h + top); left += (int)g.MeasureString(digit, settings.Font).Width; //TITLE if (title != null) { g.DrawString(title, settings.Font, brush, left, settings.TopMargin); } g.FillRectangle(brush, left, top, settings.BarWidth, settings.BarCodeHeight); //1 left += settings.BarWidth; left += settings.BarWidth; //0 g.FillRectangle(brush, left, top, settings.BarWidth, settings.BarCodeHeight); //1 left += settings.BarWidth; return(left); }