private void button2_Click(object sender, EventArgs e)
{
OpenFileDialog op = new OpenFileDialog();
MultiFormatReader mutiReader = new com.google.zxing.MultiFormatReader();
Bitmap img = (Bitmap)Bitmap.FromFile(op.ShowDialog().ToString());
if (img == null)
return;
LuminanceSource ls = new RGBLuminanceSource(img, img.Width, img.Height);
BinaryBitmap bb = new BinaryBitmap(new com.google.zxing.common.HybridBinarizer(ls));
Result r = mutiReader.decode(bb);
txtMsg.Text = r.Text;
}
自己看吧,我就不解释了
简单的就是将输入光标定位到TextBox框中,然后扫描枪扫二维码,读出的东西会自动填到TextBox中