欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

.NET中怎么生成二維碼

.NET中怎么生成二維碼,很多新手對(duì)此不是很清楚,為了幫助大家解決這個(gè)難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來學(xué)習(xí)下,希望你能有所收獲。

十多年的土默特左旗網(wǎng)站建設(shè)經(jīng)驗(yàn),針對(duì)設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對(duì)一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。成都全網(wǎng)營(yíng)銷的優(yōu)勢(shì)是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整土默特左旗建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。創(chuàng)新互聯(lián)從事“土默特左旗網(wǎng)站設(shè)計(jì)”,“土默特左旗網(wǎng)站推廣”以來,每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。

1、新建一個(gè)window應(yīng)用程序,然后引入.NET二維碼類庫(開源的類庫,可從網(wǎng)上下載):

.NET中怎么生成二維碼

2、構(gòu)建UI界面,代碼如下:

namespace WinQRCode {     partial class Form1     {         /// <summary>         /// 必需的設(shè)計(jì)器變量。         /// </summary>         private System.ComponentModel.IContainer components = null;          /// <summary>         /// 清理所有正在使用的資源。         /// </summary>         /// <param name="disposing">如果應(yīng)釋放托管資源,為 true;否則為 false。</param>         protected override void Dispose(bool disposing)         {             if (disposing && (components != null))             {                 components.Dispose();             }             base.Dispose(disposing);         }          #region Windows 窗體設(shè)計(jì)器生成的代碼          /// <summary>         /// 設(shè)計(jì)器支持所需的方法 - 不要         /// 使用代碼編輯器修改此方法的內(nèi)容。         /// </summary>         private void InitializeComponent()         {             this.button1 = new System.Windows.Forms.Button();             this.button2 = new System.Windows.Forms.Button();             this.pictureBox1 = new System.Windows.Forms.PictureBox();             this.label1 = new System.Windows.Forms.Label();             this.textBox1 = new System.Windows.Forms.TextBox();             this.label2 = new System.Windows.Forms.Label();             this.lbl解碼信息 = new System.Windows.Forms.Label();             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();             this.SuspendLayout();             //              // button1             //              this.button1.Location = new System.Drawing.Point(446, 31);             this.button1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);             this.button1.Name = "button1";             this.button1.Size = new System.Drawing.Size(103, 37);             this.button1.TabIndex = 0;             this.button1.Text = "編碼";             this.button1.UseVisualStyleBackColor = true;             this.button1.Click += new System.EventHandler(this.button1_Click);             //              // button2             //              this.button2.Location = new System.Drawing.Point(446, 81);             this.button2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);             this.button2.Name = "button2";             this.button2.Size = new System.Drawing.Size(103, 37);             this.button2.TabIndex = 1;             this.button2.Text = "解碼";             this.button2.UseVisualStyleBackColor = true;             this.button2.Click += new System.EventHandler(this.button2_Click);             //              // pictureBox1             //              this.pictureBox1.Location = new System.Drawing.Point(23, 117);             this.pictureBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);             this.pictureBox1.Name = "pictureBox1";             this.pictureBox1.Size = new System.Drawing.Size(279, 253);             this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;             this.pictureBox1.TabIndex = 2;             this.pictureBox1.TabStop = false;             //              // label1             //              this.label1.AutoSize = true;             this.label1.Location = new System.Drawing.Point(18, 39);             this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);             this.label1.Name = "label1";             this.label1.Size = new System.Drawing.Size(69, 25);             this.label1.TabIndex = 3;             this.label1.Text = "信息:";             //              // textBox1             //              this.textBox1.Location = new System.Drawing.Point(95, 37);             this.textBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);             this.textBox1.Name = "textBox1";             this.textBox1.Size = new System.Drawing.Size(333, 31);             this.textBox1.TabIndex = 4;             //              // label2             //              this.label2.AutoSize = true;             this.label2.Location = new System.Drawing.Point(18, 81);             this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);             this.label2.Name = "label2";             this.label2.Size = new System.Drawing.Size(88, 25);             this.label2.TabIndex = 5;             this.label2.Text = "二維碼:";             //              // lbl解碼信息             //              this.lbl解碼信息.AutoSize = true;             this.lbl解碼信息.Location = new System.Drawing.Point(101, 81);             this.lbl解碼信息.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);             this.lbl解碼信息.Name = "lbl解碼信息";             this.lbl解碼信息.Size = new System.Drawing.Size(0, 25);             this.lbl解碼信息.TabIndex = 6;             //              // Form1             //              this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;             this.ClientSize = new System.Drawing.Size(572, 384);             this.Controls.Add(this.lbl解碼信息);             this.Controls.Add(this.label2);             this.Controls.Add(this.textBox1);             this.Controls.Add(this.label1);             this.Controls.Add(this.pictureBox1);             this.Controls.Add(this.button2);             this.Controls.Add(this.button1);             this.Font = new System.Drawing.Font("微軟雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));             this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);             this.Name = "Form1";             this.Text = "二維碼";             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();             this.ResumeLayout(false);             this.PerformLayout();          }          #endregion          private System.Windows.Forms.Button button1;         private System.Windows.Forms.Button button2;         private System.Windows.Forms.PictureBox pictureBox1;         private System.Windows.Forms.Label label1;         private System.Windows.Forms.TextBox textBox1;         private System.Windows.Forms.Label label2;         private System.Windows.Forms.Label lbl解碼信息;     } }

圖形如下所示:
.NET中怎么生成二維碼

3、編寫 編碼和解碼按鈕事件,進(jìn)行編碼和解碼處理:

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;  namespace WinQRCode {     using ThoughtWorks.QRCode.Codec;     using ThoughtWorks.QRCode.Codec.Data;     using ThoughtWorks.QRCode.Codec.Util;     using System.IO;     using PdfToImage;     public partial class Form1 : Form     {         public Form1()         {             InitializeComponent();         }         /// <summary>         /// 編碼         /// </summary>         /// <param name="sender"></param>         /// <param name="e"></param>         private void button1_Click(object sender, EventArgs e)         {             if (this.textBox1.Text != "")             {                 Cursor.Current = Cursors.WaitCursor;                 if (textBox1.Text.Trim() == String.Empty)                 {                     MessageBox.Show("不能為空.");                     return;                 }                 QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();                                qrCodeEncoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE;                 qrCodeEncoder.QRCodeScale = 4;                 qrCodeEncoder.QRCodeVersion = 7;                             qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M;                                System.Drawing.Image image;                 String data = textBox1.Text;                 //編碼                 image = qrCodeEncoder.Encode(data);                 //圖片顯示                 this.pictureBox1.Image = image;                 Cursor.Current = Cursors.Default;              }         }         /// <summary>         /// 解碼         /// </summary>         /// <param name="sender"></param>         /// <param name="e"></param>         private void button2_Click(object sender, EventArgs e)         {             Cursor.Current = Cursors.WaitCursor;             Bitmap b = this.pictureBox1.Image as Bitmap;             try             {                 QRCodeDecoder decoder = new QRCodeDecoder();                 //解碼                 String decodedString = decoder.decode(new QRCodeBitmapImage(b));                 //顯示解碼信息                 this.lbl解碼信息.Text += decodedString ;             }             catch (Exception ex)             {                 MessageBox.Show(ex.Message);             }             Cursor.Current = Cursors.Default;         }          private void Form1_Load(object sender, EventArgs e)         {          }     } }

看完上述內(nèi)容是否對(duì)您有幫助呢?如果還想對(duì)相關(guān)知識(shí)有進(jìn)一步的了解或閱讀更多相關(guān)文章,請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝您對(duì)創(chuàng)新互聯(lián)的支持。

分享標(biāo)題:.NET中怎么生成二維碼
轉(zhuǎn)載來源:http://aaarwkj.com/article34/goospe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPT全網(wǎng)營(yíng)銷推廣、品牌網(wǎng)站建設(shè)企業(yè)網(wǎng)站制作、網(wǎng)站收錄、Google

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站網(wǎng)頁設(shè)計(jì)
在线观看不卡的黄色地址| 丁香六月五月色婷婷网| 好吊精品视频在线观看| 国产大学生吞精在线视频| 国产视频一区二区麻豆| 91av国产一区二区| 一区二区久久精品视频| av网址不卡在线免费观看| 国产精品乱码精品久久久| 在线观看不卡的黄色地址 | 尤物欧美精品一区二区三区| 夫妻性生活免费看视频| 人人妻人人澡人人爽久久av| 久草区免费在线视频播放| 91亚洲熟妇国产熟妇肥婆| 久久人妻一区二区三区免费密臀 | 四虎精品在线免费视频| 亚洲精品网站国产高清| 在线日韩观看免费av| 四虎在线免费视频播放| 久久久人妻精品少妇av| 欧美一区二区三在线| 精品三级一区二区三区| 日本韩国国语对白一区二区三区 | 国产传媒在线视频观看| 很黄很刺激的视频中文字幕| 亚洲黄片在线免费播放观看| 中文字幕亚洲天堂久久| 久久精品免成人费电影| 亚洲国产精品第一区第二区| 成人黄色片久久久大全| 91在线视频国产网站| 国语对白自拍视频在线播放| 日韩欧美一区二区福利视频| 蜜臀一二区免费在线视频| 欧美日韩精品乱码在线观看| 日本在线一区二区视频麻豆| 18岁下禁止看的视频| 日韩人妻高清精品专区| 18禁黄网站免费观看在线| 热门精品一区二区三区|