資源簡介
下載后可在VS2010上直接運行,有源碼。

代碼片段和文件信息
using?System;
using?System.Drawing;
using?System.Windows.Forms;
using?com.google.zxing;
using?COMMON?=?com.google.zxing.common;
namespace?zxingGUI
{
????public?partial?class?Form1?:?Form
????{???????
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????????
????????}
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????if?(this.openFileDialog1.ShowDialog()?!=?DialogResult.OK)
????????????{
????????????????return;
????????????}
????????????Image?img?=?Image.FromFile(this.openFileDialog1.FileName);????????????????????????
????????????Bitmap?bmap;
????????????try
????????????{
????????????????bmap?=?new?Bitmap(img);
????????????}
????????????catch?(System.IO.IOException?ioe)
????????????{
????????????????MessageBox.Show(ioe.ToString());
????????????????return;
????????????}
????????????if?(bmap?==?null)
????????????{
????????????????MessageBox.Show(“Could?not?decode?image“);
????????????????return;
????????????}
????????????LuminanceSource?source?=?new?RGBLuminanceSource(bmap?bmap.Width?bmap.Height);
????????????com.google.zxing.BinaryBitmap?bitmap?=?new?com.google.zxing.BinaryBitmap(new?COMMON.HybridBinarizer(source));
????????????Result?result;
????????????try
????????????{
????????????????result?=?new?MultiFormatReader().decode(bitmap);
????????????}
????????????catch(ReaderException?re)
????????????{
????????????????MessageBox.Show(re.ToString());
????????????????return;
????????????}
????????????
????????????MessageBox.Show(result.Text);????????
????????}
????????private?void?button2_Click(object?sender?EventArgs?e)
????????{
????????????if?(string.IsNullOrEmpty(this.textBox1.Text.Trim()))
????????????{
????????????????MessageBox.Show(“請輸入需要轉換的信息!“);
????????????????return;
????????????}
????????????string?content?=?this.textBox1.Text;
????????????SaveFileDialog?sFD?=?new?SaveFileDialog();
????????????sFD.Filter?=?“*.png|*.png“;
????????????sFD.DefaultExt?=?“*.png|*.png“;
????????????sFD.AddExtension?=?true;????????????
????????????
????????????try
????????????{
????????????????if?(sFD.ShowDialog()?==?DialogResult.OK)
????????????????{
????????????????????//string?content?=?@“url:http://writeblog.csdn.net/PostEdit.aspx;?name:nickwar“;
????????????????????COMMON.ByteMatrix?byteMatrix?=?new?MultiFormatWriter().encode(content?BarcodeFormat.QR_CODE?350?350);
????????????????????writeToFile(byteMatrix?System.Drawing.Imaging.ImageFormat.Png?sFD.FileName);
????????????????}
????????????}
????????????catch?(Exception?ex)
????????????{
????????????????MessageBox.Show(ex.Message);
????????????}
????????}
????????public?static?void?writeToFile(COMMON.ByteMatrix?matrix?System.Drawing.Imaging.ImageFormat?format?string?file)
????????{
????????????System.Drawing.Imaging.EncoderParameters?eps?=?new?System.Drawing.Ima
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????.......????217088??2012-06-25?08:49??ZXingGUI-master\ZXingGUI-master\bin\Debug\zxing.dll
?????文件??????10752??2014-03-19?16:56??ZXingGUI-master\ZXingGUI-master\bin\Debug\zxingGUI.exe
?????文件??????24064??2014-03-19?16:56??ZXingGUI-master\ZXingGUI-master\bin\Debug\zxingGUI.pdb
????.......?????11608??2014-03-19?16:55??ZXingGUI-master\ZXingGUI-master\bin\Debug\zxingGUI.vshost.exe
?????文件????????490??2010-03-17?22:39??ZXingGUI-master\ZXingGUI-master\bin\Debug\zxingGUI.vshost.exe.manifest
?????文件???????3919??2014-03-19?16:26??ZXingGUI-master\ZXingGUI-master\Form1.cs
????.......??????3482??2012-06-25?08:49??ZXingGUI-master\ZXingGUI-master\Form1.Designer.cs
????.......??????6017??2012-06-25?08:49??ZXingGUI-master\ZXingGUI-master\Form1.resx
?????文件????????678??2014-03-19?16:24??ZXingGUI-master\ZXingGUI-master\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????6249??2014-03-19?16:56??ZXingGUI-master\ZXingGUI-master\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
????.......???????652??2012-06-25?08:49??ZXingGUI-master\ZXingGUI-master\obj\Debug\GenerateResource-ResGen.read.1.tlog
????.......???????494??2012-06-25?08:49??ZXingGUI-master\ZXingGUI-master\obj\Debug\GenerateResource-ResGen.write.1.tlog
????.......??????3203??2012-06-25?08:49??ZXingGUI-master\ZXingGUI-master\obj\Debug\ResolveAssemblyReference.cache
????.......??????4608??2012-06-25?08:49??ZXingGUI-master\ZXingGUI-master\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
?????文件???????1933??2014-03-19?16:56??ZXingGUI-master\ZXingGUI-master\obj\Debug\zxingGUI.csproj.FileListAbsolute.txt
?????文件????????975??2014-03-19?16:56??ZXingGUI-master\ZXingGUI-master\obj\Debug\zxingGUI.csproj.GenerateResource.Cache
?????文件??????10752??2014-03-19?16:56??ZXingGUI-master\ZXingGUI-master\obj\Debug\zxingGUI.exe
?????文件????????180??2014-03-19?16:56??ZXingGUI-master\ZXingGUI-master\obj\Debug\zxingGUI.Form1.resources
?????文件??????24064??2014-03-19?16:56??ZXingGUI-master\ZXingGUI-master\obj\Debug\zxingGUI.pdb
?????文件????????180??2014-03-19?16:56??ZXingGUI-master\ZXingGUI-master\obj\Debug\zxingGUI.Properties.Resources.resources
????.......???????489??2012-06-25?08:49??ZXingGUI-master\ZXingGUI-master\Program.cs
????.......??????1348??2012-06-25?08:49??ZXingGUI-master\ZXingGUI-master\Properties\AssemblyInfo.cs
????.......??????2852??2012-06-25?08:49??ZXingGUI-master\ZXingGUI-master\Properties\Resources.Designer.cs
????.......??????5612??2012-06-25?08:49??ZXingGUI-master\ZXingGUI-master\Properties\Resources.resx
????.......??????1104??2012-06-25?08:49??ZXingGUI-master\ZXingGUI-master\Properties\Settings.Designer.cs
????.......???????249??2012-06-25?08:49??ZXingGUI-master\ZXingGUI-master\Properties\Settings.settings
?????文件???????4297??2014-03-19?16:22??ZXingGUI-master\ZXingGUI-master\zxingGUI.csproj
????.......???????905??2012-06-25?08:49??ZXingGUI-master\ZXingGUI-master\zxingGUI.sln
????..A..H.?????21504??2014-03-19?16:57??ZXingGUI-master\ZXingGUI-master\zxingGUI.suo
?????目錄??????????0??2012-06-25?08:49??ZXingGUI-master\ZXingGUI-master\obj\Debug\TempPE
............此處省略10個文件信息
- 上一篇:C#中Chart控件
- 下一篇:webservice 上傳 asp.net界面
評論
共有 條評論