public void testControl1_Paint(object sender, PaintEventArgs e)
{
int x = 10;
SizeF hSize = e.Graphics.MeasureString(str1, InfoFont);
SizeF fSize = e.Graphics.MeasureString(str1, footerFont);
int headerX = 0;
int footerX = 0;
if (align == AlignType.Left)
{
x = leftMargin;
headerX = leftMargin;
footerX = leftMargin;
}
else if (align == AlignType.Center)
{
headerX = (Width - (int)hSize.Width) / 2;
footerX = (Width - (int)fSize.Width) / 2;
}
else
{
x = Width - leftMargin;
headerX = Width - (int)hSize.Width - leftMargin;
footerX = Width - (int)fSize.Width - leftMargin;
}
e.Graphics.DrawString("*" + str1 + "*", barcodeFont, Brushes.Black, leftMargin, topMargin);
e.Graphics.FillRectangle(Brushes.White, 0, topMargin + height, 200, Height);
e.Graphics.DrawString(str1, footerFont, Brushes.Black, footerX, topMargin + height + 3);
e.Graphics.DrawString("*" + str2 + "*", barcodeFont, Brushes.Black, leftMargin, topMargin+100);
e.Graphics.FillRectangle(Brushes.White, 0, topMargin + height+100, 200, Height);
e.Graphics.DrawString(str2, footerFont, Brushes.Black, footerX, topMargin + height + 3 +100);
關于這段代碼,是我模仿寫的一個輸入字串輸出條碼的程序,中間的判斷陳述句,和下面的原理不是很理解,希望有前輩能幫我稍微的決議一下,這里面需要注意的地方和為什么要這么寫,剛畢業,剛接觸這類東西,所以。。。麻煩了謝謝
設計圖圖是兩個TBX輸出兩個條形碼
這個代碼有些地方還是有問題的
uj5u.com熱心網友回復:
額, 這個嘛,我也不是特別清楚,畢竟是一連串的條碼代碼,有點復雜,不過你可以看看網上一些有關barcode的例子轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/127649.html
