C#生成Code39条形码而非条形码字体的方法

2019-12-26 13:16:00王振洲
  • }  /// <summary> 
  • /// 供人识别是否显示起止符  /// </summary> 
  • public bool IsDisplayStartStopSign  { 
  • get { return this._isDisplayStartStopSign; }  set { this._isDisplayStartStopSign = value; } 
  • }  #endregion 
  • /// <summary>  /// 默认构造函数 
  • /// 初始化  /// </summary> 
  • public CSharpCode39()  { 
  • this.initData();  } 
  • public CSharpCode39(string dataToEncode)  { 
  • this.initData();  this._dataToEncode = dataToEncode; 
  • }  /// <summary> 
  • /// 默认构造函数  /// 初始化数据 
  • /// </summary>  private void initData() 
  • {  this._humanReadableFont = "Arial"; 
  • this._humanReadableSize = 10f;  this._codeBarColor = Color.Black; 
  • this._moduleHeight = 15f;//模块高度毫米  this._moduleWidth = 0.35f;//模块宽度毫米 
  • this._ratio = 3f;  this._marginX =2; 
  • this._marginY =2;  this._checksum = true; 
  • this._isDisplayCheckCode = false;  this._isDisplayStartStopSign = false; 
  • }  private char[] _bitpattern_c39(string rawdata, ref int finalLength) 
  • {  //0x27 39  
  • //0x50 80  if ((rawdata.Length == 0) || (rawdata.Length > 0x50 /*0x27*/)) 
  • {  return null; 
  • }  for (int i = 0; i < rawdata.Length; i++) 
  • {  if ((rawdata[i] == '') || (rawdata[i] > 'x007f')) 
  • {  return null; 
  • }  } 
  • byte[] data = processTilde(rawdata);  if (data.Length == 0) 
  • {  return null; 
  • }  byte[] buffer2 = this.processExtended(data); 
  • if ((buffer2.Length == 0) || (buffer2.Length > /*40*/80))  {