public void Draw(Graphics g, RectangleF bounds, BarcodeOrientation orientation, string barcode) { byte[] symbol = _symbology.GetSymbol(barcode); float barWidth = (orientation == BarcodeOrientation.Horizontal? bounds.Width : bounds.Height) / symbol.Length; float x = bounds.X, y = bounds.Y; for (int i = 0; i < symbol.Length; i++) { switch (orientation) { case BarcodeOrientation.Horizontal: if (symbol[i] == 1) { g.FillRectangle(Brushes.Black, x, y, barWidth, bounds.Height); } x += barWidth; break; case BarcodeOrientation.Vetical: if (symbol[i] == 1) { g.FillRectangle(Brushes.Black, x, y, bounds.Width, barWidth); } y += barWidth; break; } } }
public Barcode(BarcodeSymbology symbology, SizeF size, BarcodeOrientation orientation) { if (symbology == null) { throw new ArgumentException("Symbology cannot be null."); } _symbology = symbology; _size = size; _orientation = orientation; }
public void Draw(Graphics g, RectangleF rect, GraphicsUnit unit, float scale, BarcodeOrientation orientation, System.Drawing.Font font, Color clrFore, Color clrBack, BarcodeDrawFlags flags, string textOnlyString) { this._barcode.Draw(g, rect, unit, scale, orientation, font, clrFore, clrBack, flags, textOnlyString); }
public void Draw(Graphics g, PointF location, BarcodeOrientation orientation, string barcode) { Draw(g, new RectangleF(location, _size), orientation, barcode); }
public void Draw(Graphics g, float x, float y, BarcodeOrientation orientation, string barcode) { Draw(g, new RectangleF(x, y, _size.Width, _size.Height), orientation, barcode); }