我解析一个字符串,其中包含条形码值(例如02410103775)。
我动态地为它创建一个标签:
private void PrintBarcodeGettingInTouchWithItsInnerZebra(string lineToParse)
{
string barcodeText = GetBarcodeVal(lineToParse);
int barcodeHeight = Convert.ToInt32(GetBarcodeHeight(lineToParse));
int barcodeVertStartPos = GetBarcodeNextVerticalStartingPoint(lineToParse);
Label lblBarcode = new Label();
lblBarcode.Text = barcodeText;
lblBarcode.Font = new Font(lblBarcode.Font.Name, barcodeHeight, lblBarcode.Font.Style);
lblBarcode.Top = barcodeVertStartPos;
lblBarcode.Left = GetBarcodeNextHorizontalStartingPoint(lineToParse);
//lblBarcode.Parent = panel2by1LabelProxy; // <-- Is this preferred, or the line below?
panel2by1LabelProxy.Controls.Add(lblBarcode);
}
现在它只显示条形码值“raw”(如“02410103775”左右);有没有办法将标签文本转换为条形码表示?我希望它能像知道正确的font.Name一样微不足道......