-
大小: 849KB文件類(lèi)型: .rar金幣: 1下載: 0 次發(fā)布日期: 2021-06-08
- 語(yǔ)言: C#
- 標(biāo)簽:
資源簡(jiǎn)介
C#利用ThoughtWorks.QRCode.dll創(chuàng)建和解析二維碼
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?ThoughtWorks.QRCode;
using?ThoughtWorks.QRCode.Codec;
using?ThoughtWorks.QRCode.Codec.Data;
namespace?WindowsFormsApplication1
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?button2_Click(object?sender?EventArgs?e)
????????{
????????????if?(!string.IsNullOrEmpty(textBox1.Text.Trim()))
????????????{
????????????????string?enCodeString?=?textBox1.Text.Trim();
????????????????QRCodeEncoder?codeEncoder?=?new?QRCodeEncoder();
????????????????pictureBox1.Image?=?codeEncoder.Encode(enCodeString?Encoding.UTF8);
????????????}
????????}
????????private?void?二維碼另存為T(mén)oolStripMenuItem_Click(object?sender?EventArgs?e)
????????{
????????????if?(pictureBox1?.Image!=null)
????????????{
????????????????SaveFileDialog?s?=?new?SaveFileDialog();
????????????????s.title?=?“保存二維碼圖片“;
????????????????s.Filter?=?“圖片文件(*.jpg)|*.jpg“;
????????????????if?(s.ShowDialog()==DialogResult.OK)
????????????????{
????????????????????pictureBox1.Image.Save(s.FileName?System.Drawing.Imaging.ImageFormat.Jpeg);
????????????????????MessageBox.Show(“保存成功“);
????????????????}
????????????}
????????}
????????string?filename?=?string.Empty;
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????OpenFileDialog?p?=?new?OpenFileDialog();
????????????p.title?=?“請(qǐng)選擇二維碼圖片“;
????????????p.Filter?=?“圖片格式(*.jpg)|*.jpg“;
????????????p.Multiselect?=?false;
????????????if?(p.ShowDialog()==DialogResult.OK)
????????????{
????????????????filename?=?p.FileName;
????????????????ss();
????????????}
????????}
????????private?void?ss()
????????{
????????????pictureBox1.Image?=?new?Bitmap(filename);
????????????QRCodeDecoder?qrDecoder?=?new?QRCodeDecoder();
??????????string?msg=?qrDecoder.decode(new?QRCodeBitmapImage(new?Bitmap(pictureBox1.Image))?Encoding.UTF8);
??????????textBox1.Text?=?msg;
??????????MessageBox.Show(“解析完成“);
????????}
????}
}
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????文件????6205440??2012-06-09?11:05??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\ThoughtWorks.QRCode.dll
?????文件??????11776??2013-10-10?14:46??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe
?????文件??????26112??2013-10-10?14:46??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.pdb
?????文件??????11600??2013-10-10?14:46??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe
?????文件????????490??2010-03-17?22:39??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.manifest
?????文件???????2286??2013-10-10?14:46??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs
?????文件???????5340??2013-10-10?14:38??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\Form1.Designer.cs
?????文件???????6022??2013-10-10?14:38??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\Form1.resx
?????文件???????2152??2013-10-10?14:12??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????6388??2013-10-10?14:46??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件????????312??2013-10-10?14:44??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\Debug\GenerateResource.read.1.tlog
?????文件????????790??2013-10-10?14:44??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\Debug\GenerateResource.write.1.tlog
?????文件??????12276??2013-10-10?14:27??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\Debug\ResolveAssemblyReference.cache
?????文件????????997??2013-10-10?14:46??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.csproj.FileListAbsolute.txt
?????文件??????11776??2013-10-10?14:46??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.exe
?????文件????????180??2013-10-10?14:44??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.Form1.resources
?????文件??????26112??2013-10-10?14:46??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.pdb
?????文件????????180??2013-10-10?14:27??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.Properties.Resources.resources
?????文件????????505??2013-10-10?14:12??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\Program.cs
?????文件???????1398??2013-10-10?14:12??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\Properties\AssemblyInfo.cs
?????文件???????2896??2013-10-10?14:12??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\Properties\Resources.Designer.cs
?????文件???????5612??2013-10-10?14:12??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\Properties\Resources.resx
?????文件???????1107??2013-10-10?14:12??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\Properties\Settings.Designer.cs
?????文件????????249??2013-10-10?14:12??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\Properties\Settings.settings
?????文件???????3951??2013-10-10?14:27??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1.csproj
?????文件????????914??2013-10-10?14:12??二維碼\WindowsFormsApplication1\WindowsFormsApplication1.sln
????..A..H.?????19968??2013-10-10?14:51??二維碼\WindowsFormsApplication1\WindowsFormsApplication1.suo
?????目錄??????????0??2013-10-10?14:12??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\Debug\TempPE
?????目錄??????????0??2013-10-10?14:46??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\Debug
?????目錄??????????0??2013-10-10?14:27??二維碼\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug
............此處省略10個(gè)文件信息
評(píng)論
共有 條評(píng)論