C#毕业设计说明书--快递单打印系统青(9)

2019-08-31 22:24

/* 6 */ \ /* 7 */ \ /* 8 */ \ /* 9 */ \ /* A */ \ /* B */ \ /* C */ \ /* D */ \ /* E */ \ /* F */ \ /* G */ \ /* H */ \ /* I */ \ /* J */ \ /* K */ \ /* L */ \ /* M */ \ /* N */ \ /* O */ \ /* P */ \ /* Q */ \ /* R */ \ /* S */ \ /* T */ \ /* U */ \ /* V */ \ /* W */ \ /* X */ \ /* Y */ \ /* Z */ \ /* - */ \ /* . */ \ /*' '*/ \ /* $ */ \ /* / */ \

35

/* + */ \ /* % */ \ /* * */ \ };

sourceCode = sourceCode.ToUpper(); Bitmap objBitmap = new Bitmap(

((thickLength * 3 + narrowLength * 7) * (intSourceLength + 2)) + (leftMargin * 2),

barCodeHeight + (topMargin * 2));

Graphics objGraphics = Graphics.FromImage(objBitmap); objGraphics.FillRectangle(Brushes.White, 0, 0, objBitmap.Width, objBitmap.Height);

for (int i = 0; i < intSourceLength; i++) {

if (AlphaBet.IndexOf(sourceCode[i]) == -1 || sourceCode[i] == '*') {

objGraphics.DrawString(\

SystemFonts.DefaultFont, Brushes.Red, leftMargin, topMargin); return objBitmap; }

strEncode = string.Format(\ Code39[AlphaBet.IndexOf(sourceCode[i])]); }

strEncode = string.Format(\ int intEncodeLength = strEncode.Length; int intBarWidth;

for (int i = 0; i < intEncodeLength; i++) //绘制 Code39 barcode {

intBarWidth = strEncode[i] == '1' ? thickLength : narrowLength; objGraphics.FillRectangle(i % 2 == 0 ? Brushes.Black : Brushes.White,

leftMargin, topMargin, intBarWidth, barCodeHeight); leftMargin += intBarWidth; }

SizeF sizeF = objGraphics.MeasureString(sourceCode, font);

36

float x = (objBitmap.Width - sizeF.Width) / 2; float y = objBitmap.Height - sizeF.Height; return objBitmap; }

//在界面上显示条形码的程序段

private void ctxt_TextChanged(object sender, EventArgs e) {

string str = null;

List ctxts = GetCTextBoxes(this.panelBillPictrue); foreach (CTextBox ctxtTemp in ctxts) {

if (ctxtTemp.IsFlag == \ { str = ctxtTemp.Text; break; } }

if (str.Length == 12) {

Bitmap bmp = GetCode39(str);

Graphics g = pictureBox1.CreateGraphics();

g.DrawImage(bmp, 0, 0, pictureBox1.Width, pictureBox1.Height); } }

//条形码打印的程序段

private void pd_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) {

Graphics g = e.Graphics;

Font font = new Font(\宋?体?\ Brush brush = new SolidBrush(Color.Black);

List ctxts = GetCTextBoxes(this.panelBillPictrue); foreach (CTextBox ctxtTemp in ctxts) {

g.DrawString(ctxtTemp.Text, font, brush, ctxtTemp.Location.X,

37

ctxtTemp.Location.Y); }

string str = null;

foreach (CTextBox ctxt in ctxts) {

if (ctxt.IsFlag == \ {

str = ctxt.Text; break; } }

if (str.Length == 12) {

Bitmap bmp = GetCode39(str);

Graphics gb = pictureBox1.CreateGraphics();

gb.DrawImage(bmp, 0, 0, pictureBox1.Width, pictureBox1.Height); } } }

38

39


C#毕业设计说明书--快递单打印系统青(9).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:“反邪教”主题班会活动简报

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: