求一个c#条码打印的实例要源代码带效果的
求条c#形码打印的实例 要带源码 最好完整点的 50分双手送上
guangyang125475@163.com有的发到这个邮箱中 谢谢了
[解决办法]
.......去和生产打印机的开发商去要sdk。。。。
就算给你代码,你也用不了阿.
OnTheRoadService service = this.ServiceBLL.CurrentService;
LastPrintList printList = new LastPrintList();
LastPrint last = new LastPrint();
last.Align = ReportLayout.CELL_ALIGN.ALIGN_CENTER;
last.CellWidth = 100;
last.FontBold = true;
last.FontSize = 14;
last.Label = "G4S Cash Services";
printList.Add(last);
last = new LastPrint();
last.Align = ReportLayout.CELL_ALIGN.ALIGN_LEFT;
last.CellWidth = 100;
last.FontBold = false;
last.FontSize = 10;
last.Label = "";
last.Value = "";
printList.Add(last);
string receNo = GetRectNo();
last = new LastPrint();
last.Align = ReportLayout.CELL_ALIGN.ALIGN_LEFT;
last.CellWidth = 40;
last.FontBold = false;
last.FontSize = 10;
last.Label = "Rect.No: ";
last.Value = receNo;
printList.Add(last);
last = new LastPrint();
last.Align = ReportLayout.CELL_ALIGN.ALIGN_LEFT;
last.CellWidth = 100;
last.FontBold = false;
last.FontSize = 10;
last.Label = "";
last.Value = "";
printList.Add(last);
string tripNo = _tripDAO.GetTrip().AsstRef;
last = new LastPrint();
last.Align = ReportLayout.CELL_ALIGN.ALIGN_LEFT;
last.CellWidth = 60;
last.FontBold = false;
last.FontSize = 10;
last.Label = "Deliver By Trip:";
last.Value = tripNo;
printList.Add(last);
if (service != null)
{
last = new LastPrint();
last.Align = ReportLayout.CELL_ALIGN.ALIGN_LEFT;
last.CellWidth = 30;
last.FontBold = false;
last.FontSize = 10;
last.Label = "Name: ";
last.Value = service.LocRef;
printList.Add(last);
last = new LastPrint();
last.Align = ReportLayout.CELL_ALIGN.ALIGN_LEFT;
last.CellWidth = 30;
last.FontBold = false;
last.FontSize = 10;
last.Label = "Addr: ";
last.Value = service.Location;
printList.Add(last);
last = new LastPrint();
last.Align = ReportLayout.CELL_ALIGN.ALIGN_LEFT;
last.CellWidth = 30;
last.FontBold = false;
last.FontSize = 10;
last.Label = "Town: ";
last.Value = service.Town;
printList.Add(last);
}
for (int i = 0; i < containers.Count; i++)
{
last = new LastPrint();
last.Align = ReportLayout.CELL_ALIGN.ALIGN_LEFT;
last.CellWidth = 70;
last.FontBold = false;
last.FontSize = 10;
last.Label = containers[i].SealNo + " " + containers[i].Value;
last.Value = "______";
printList.Add(last);
}
last = new LastPrint();
last.Align = ReportLayout.CELL_ALIGN.ALIGN_LEFT;
last.CellWidth = 100;
last.FontBold = false;
last.FontSize = 10;
last.Label = "";
last.Value = "";
printList.Add(last);
last = new LastPrint();
last.Align = ReportLayout.CELL_ALIGN.ALIGN_LEFT;
last.CellWidth = 30;
last.FontBold = false;
last.FontSize = 10;
last.Label = "SEALS:";
last.Value = containers.Count + "";
printList.Add(last);
last = new LastPrint();
last.Align = ReportLayout.CELL_ALIGN.ALIGN_LEFT;
last.CellWidth = 100;
last.FontBold = false;
last.FontSize = 10;
last.Label = "";
last.Value = "";
printList.Add(last);
last = new LastPrint();
last.Align = ReportLayout.CELL_ALIGN.ALIGN_CENTER;
last.CellWidth = 100;
last.FontBold = false;
last.FontSize = 10;
last.Label = "AC Card No.";
last.Value = "";
printList.Add(last);
last = new LastPrint();
last.Align = ReportLayout.CELL_ALIGN.ALIGN_CENTER;
last.CellWidth = 100;
last.FontBold = false;
last.FontSize = 10;
last.Label = _accBLL.GetAcc().AccNo;
last.Value = "";
printList.Add(last);
last = new LastPrint();
last.Align = ReportLayout.CELL_ALIGN.ALIGN_LEFT;
last.CellWidth = 100;
last.FontBold = false;
last.FontSize = 10;
last.Label = "";
last.Value = "";
printList.Add(last);
last = new LastPrint();
last.Align = ReportLayout.CELL_ALIGN.ALIGN_CENTER;
last.CellWidth = 100;
last.FontBold = false;
last.FontSize = 10;
last.Label = "_______________________________";
last.Value = "";
printList.Add(last);
last = new LastPrint();
last.Align = ReportLayout.CELL_ALIGN.ALIGN_CENTER;
last.CellWidth = 100;
last.FontBold = false;
last.FontSize = 10;
last.Label = "Print Name";
last.Value = "";
printList.Add(last);
last = new LastPrint();
last.Align = ReportLayout.CELL_ALIGN.ALIGN_LEFT;
last.CellWidth = 100;
last.FontBold = false;
last.FontSize = 10;
last.Label = "";
last.Value = "";
printList.Add(last);
last = new LastPrint();
last.Align = ReportLayout.CELL_ALIGN.ALIGN_LEFT;
last.CellWidth = 100;
last.FontBold = false;
last.FontSize = 10;
last.Label = "";
last.Value = "";
printList.Add(last);
last = new LastPrint();
last.Align = ReportLayout.CELL_ALIGN.ALIGN_LEFT;
last.CellWidth = 100;
last.FontBold = false;
last.FontSize = 10;
last.Label = "";
last.Value = "";
printList.Add(last);
_lastPrintList = printList;
_isLoadReport = false;
LastPrint();
LastPrint();
_printNumber++;
_printCount = 2;
BLLManager.UpdateLastPrintListNode();
}
catch (Exception ex)
{
throw ex;
}
[解决办法]
public string bar_code(object str, int ch, int cw, int type_code)
{
//str:输入的字符串;ch:要显示条形码的高度;cw:要显示条形码的宽度;type_code:代码类型
string strTmp = str.ToString();
string code = strTmp;
// ToLower()将string转化成小写形式的副本,返回是使用指定区域的性的大小写规则。
strTmp = strTmp.ToLower();
int height = ch;
int width = cw;
//将传入的参数进行转化。
strTmp = strTmp.Replace("0", "_|_|__||_||_|");
strTmp = strTmp.Replace("1", "_||_|__|_|_||");
strTmp = strTmp.Replace("2", "_|_||__|_|_||");
strTmp = strTmp.Replace("3", "_||_||__|_|_|");
strTmp = strTmp.Replace("4", "_|_|__||_|_||");
strTmp = strTmp.Replace("5", "_||_|__||_|_|");
strTmp = strTmp.Replace("7", "_|_|__|_||_||");
strTmp = strTmp.Replace("6", "_|_||__||_|_|");
strTmp = strTmp.Replace("8", "_||_|__|_||_|");
strTmp = strTmp.Replace("9", "_|_||__|_||_|");
strTmp = strTmp.Replace("a", "_||_|_|__|_||");
strTmp = strTmp.Replace("b", "_|_||_|__|_||");
strTmp = strTmp.Replace("c", "_||_||_|__|_|");
strTmp = strTmp.Replace("d", "_|_|_||__|_||");
strTmp = strTmp.Replace("e", "_||_|_||__|_|");
strTmp = strTmp.Replace("f", "_|_||_||__|_|");
strTmp = strTmp.Replace("g", "_|_|_|__||_||");
strTmp = strTmp.Replace("h", "_||_|_|__||_|");
strTmp = strTmp.Replace("i", "_|_||_|__||_|");
strTmp = strTmp.Replace("j", "_|_|_||__||_|");
strTmp = strTmp.Replace("k", "_||_|_|_|__||");
strTmp = strTmp.Replace("l", "_|_||_|_|__||");
strTmp = strTmp.Replace("m", "_||_||_|_|__|");
strTmp = strTmp.Replace("n", "_|_|_||_|__||");
strTmp = strTmp.Replace("o", "_||_|_||_|__|");
strTmp = strTmp.Replace("p", "_|_||_||_|__|");
strTmp = strTmp.Replace("r", "_||_|_|_||__|");
strTmp = strTmp.Replace("q", "_|_|_|_||__||");
strTmp = strTmp.Replace("s", "_|_||_|_||__|");
strTmp = strTmp.Replace("t", "_|_|_||_||__|");
strTmp = strTmp.Replace("u", "_||__|_|_|_||");
strTmp = strTmp.Replace("v", "_|__||_|_|_||");
strTmp = strTmp.Replace("w", "_||__||_|_|_|");
strTmp = strTmp.Replace("x", "_|__|_||_|_||");
strTmp = strTmp.Replace("y", "_||__|_||_|_|");
strTmp = strTmp.Replace("z", "_|__||_||_|_|");
strTmp = strTmp.Replace("-", "_|__|_|_||_||");
strTmp = strTmp.Replace("*", "_|__|_||_||_|");
strTmp = strTmp.Replace("/", "_|__|__|_|__|");
strTmp = strTmp.Replace("%", "_|_|__|__|__|");
strTmp = strTmp.Replace("+", "_|__|_|__|__|");
strTmp = strTmp.Replace(".", "_||__|_|_||_|");
strTmp = strTmp.Replace("_", "<span style='height:" + height + ";width:" + width + ";background:#FFFFFF;'></span>");
strTmp = strTmp.Replace("|", "<span style='height:" + height + ";width:" + width + ";background:#000000;'></span>");
if (type_code == 1)
{
return strTmp + "<BR>" + code;
}
else
{
return strTmp;
}
}
使用时,参数str的前后加*,不然条码枪是读不出的
[解决办法]
up..........
这有个你看看
多学习下。