您好,欢迎光临本网站![请登录][注册会员]  
文件名称: C# 生成条形码
  所属分类: .Net
  开发工具:
  文件大小: 580kb
  下载次数: 0
  上传时间: 2014-01-03
  提 供 者: jack****
 详细说明: /// /// 生成条码 /// private void btnEncode_Click(object sender, EventArgs e) { errorProvider1.Clear(); int W = Convert.ToInt32(this.txtWidth.Text.Trim()); int H = Convert.ToInt32(this.txtHeight.Text.Trim()); int AddNum = Convert.ToInt32(this.tbAddNum.Text.Trim()); int SerialNo = Convert.ToInt32(this.tbSerialNO.Text.Trim()); CodeLib.AlignmentPositions Align = CodeLib.AlignmentPositions.CENTER; switch (cbBarcodeAlign.SelectedItem.ToString().Trim().ToLower()) { case "left": Align = CodeLib.AlignmentPositions.LEFT; break; case "right": Align = CodeLib.AlignmentPositions.RIGHT; break; default: Align = CodeLib.AlignmentPositions.CENTER; break; } CodeLib.TYPE type = CodeLib.TYPE.UNSPECIFIED; switch (cbEncodeType.SelectedItem.ToString().Trim()) { case "Code 128": type = CodeLib.TYPE.CODE128; break; case "Code 128-A": type = CodeLib.TYPE.CODE128A; break; case "Code 128-B": type = CodeLib.TYPE.CODE128B; break; default: MessageBox.Show("请指定编码类型。"); break; } try { if (type != CodeLib.TYPE.UNSPECIFIED) { b.IncludeLabel = this.chkGenerateLabel.Checked; b.Alignment = Align; switch (this.cbLabelLocation.SelectedItem.ToString().Trim().ToUpper()) { case "BOTTOMLEFT": b.LabelPosition = CodeLib.LabelPositions.BOTTOMLEFT; break; case "BOTTOMRIGHT": b.LabelPosition = CodeLib.LabelPositions.BOTTOMRIGHT; break; case "TOPCENTER": b.LabelPosition = CodeLib.LabelPositions.TOPCENTER; break; case "TOPLEFT": b.LabelPosition = CodeLib.LabelPositions.TOPLEFT; break; case "TOPRIGHT": b.LabelPosition = CodeLib.LabelPositions.TOPRIGHT; break; default: b.LabelPosition = CodeLib.LabelPositions.BOTTOMCENTER; break; } int SerialLen = this.tbSerialNO.Text.Trim().Length; string Barcodedata = ""; int i = 0; do { int zeroNum = SerialLen - SerialNo.ToString().Trim().Length; switch (zeroNum) { case 0: Barcodedata = this.txtData.Text.Trim() + SerialNo.ToString(); break; case 1: Barcodedata = this.txtData.Text.Trim() + SerialNo.ToString().Insert(0, "0"); break; case 2: Barcodedata = this.txtData.Text.Trim() + SerialNo.ToString().Insert(0, "00"); break; case 3: Barcodedata = this.txtData.Text.Trim() + SerialNo.ToString().Insert(0, "000"); break; default : Barcodedata = this.txtData.Text.Trim() + SerialNo.ToString().Insert(0, "0000"); break; } barcode.Image = b.Encode(type, Barcodedata.ToString(), W, H); i++; SerialNo++; this.Refresh(); Thread.Sleep(1000); //Printer(); //打印 //Thread.Sleep(500); } while (i< AddNum); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: C# 条形码
 输入关键字,在本站1000多万海量源码库中尽情搜索: