【发布时间】:2014-01-21 06:14:24
【问题描述】:
我有一个 PictureBox 类型的数组。我想将其填充为字符串列表,然后将其转换为条形码。但是我叔叔把字符串转换成PictureBox。有什么步骤可以让它们兼容吗?
System.Windows.Forms.PictureBox[] PictureBoxArray = new PictureBox[3];
List<string> serial = new List<string>;
public void ConvertToBarCode()
{
BarcodeLib.TYPE barcodetype1 = BarcodeLib.TYPE.CODE39;
BarcodeLib.Barcode bar1 = new BarcodeLib.Barcode();
bar1.IncludeLabel = true;
PictureBoxArray[0] = serial[0]; // Want to Convert String to PictureBox
PictureBoxArray[0].Image = bar1.Encode(barcodetype1, SerialNumberList[0]);
}
我已经用字符串填充了序列列表,现在只想要转换。
【问题讨论】:
-
即使它已编译,您希望该行做什么?当您将字符串转换为图片框时,您期望会发生什么?
-
你可以看看可能会质疑它可以帮助stackoverflow.com/questions/20244595/…
-
我首先必须填充 PictureBox 数组,然后更改其 Image 属性。
-
我们知道,但刺痛看起来如何?
-
我的字符串看起来像这样 "S1101243" 现在我使用 Encode 方法获取字符串并将其传递给 PictureBox 的 Image 属性,就像这样 PictureBoxArray[0].Image = bar1.Encode(barcodetype1 , S1101243);但在此之前我必须将值传递给 PictureBox[0] 否则它会给出 NullReferenceException .. 而我的实际问题是这个 stackoverflow.com/questions/21228198/…
标签: c# string list picturebox