private void GenerateBarcode(string data, ref BarcodeDTO b) { int W = 200; int H = 100; AlignmentPositions Align = AlignmentPositions.CENTER; TYPE type = TYPE.CODE39; try { Barcode _barcode = new Barcode(data, type); if (type != TYPE.UNSPECIFIED) { _barcode.IncludeLabel = true; _barcode.Alignment = Align; _barcode.RotateFlipType = System.Drawing.RotateFlipType.RotateNoneFlipNone; _barcode.LabelPosition = LabelPositions.BOTTOMCENTER; _barcode.Width = W; _barcode.Height = H; _barcode.BackColor = System.Drawing.Color.White; _barcode.ForeColor = System.Drawing.Color.Black; b.BarcodeImage = _barcode.GetImageData(SaveTypes.GIF); b.BarcodeValue = _barcode.EncodedValue; } }//try catch (Exception ex) { }//catch }