日韩精品亚洲精品中文字幕乱伦AV|曰韩区二区三区日韩中文字幕五码|ady99久久人人看人人摸人人|动漫一区二区黄99精品视频在线|AV片在线观看亚洲中文国产精品|伦乱在线VA欧美性爱一二区|亚洲无码mv91热色视频|激情六月综合欧美精品中文

當(dāng)前位置:首頁(yè) > 軟件開(kāi)放 > 正文內(nèi)容

程序代碼生成3d文字(3d編程語(yǔ)言)

軟件開(kāi)放10個(gè)月前 (04-22)485

背景

二維碼是越來(lái)越流行了,很多地方都有可能是使用到。如果是靜態(tài)的二維碼還是比較好處理的,通過(guò)在線工具就可以直接生成一張二維碼圖片,比如:草料二維碼。但有的時(shí)候是需要?jiǎng)討B(tài)生成的(根據(jù)動(dòng)態(tài)數(shù)據(jù)生成),這個(gè)使用在線就工具就無(wú)法實(shí)現(xiàn)了。最好是能在代碼中直接生成一個(gè)二維碼圖片,這里我就介紹下使用QRCoder類(lèi)庫(kù)在代碼中生成二維碼。

程序代碼生成3d文字(3d編程語(yǔ)言)

網(wǎng)上生成二維碼的組件還是挺多的,但是真正好用且快速的卻不多。QRCoder就是我在眾多中找到的,它的生成速度快、而且使用也相當(dāng)方便。

開(kāi)始編碼

1、安裝 QRCoder組件。在項(xiàng)目上通過(guò)NuGet包管理器來(lái)安裝,搜索名稱(chēng):QRCoder

2、在代碼中添加引用:using QRCoder;

3、編碼生成

pictureBoxQRCode.BackgroundImage = qrCode.GetGraphic( 20, Color.Black, Color.White, GetIconBitmap, ( int) iconSize.Value);

this.pictureBoxQRCode.Size = newSystem.Drawing.Size(pictureBoxQRCode.Width, pictureBoxQRCode.Height); //Set the SizeMode to center the image.this.pictureBoxQRCode.SizeMode = PictureBoxSizeMode.CenterImage;

pictureBoxQRCode.SizeMode = PictureBoxSizeMode.StretchImage;}}}}

運(yùn)行效果

上面代碼運(yùn)行的結(jié)果

加個(gè)Logo吧

還可以加上logo

完整代碼

namespaceQRCoderDemo{publicpartialclassForm1: Form{publicForm1( ) {InitializeComponent;}

privatevoidForm1_Load( objectsender, EventArgs e ) {comboBoxECC.SelectedIndex = 0; //Pre-select ECC level "L"RenderQrCode;}

展開(kāi)全文

privatevoidbuttonGenerate_Click( objectsender, EventArgs e ) {RenderQrCode;}

privatevoidRenderQrCode( ) {stringlevel = comboBoxECC.SelectedItem.ToString; QRCodeGenerator.ECCLevel eccLevel = (QRCodeGenerator.ECCLevel)(level == "L"? 0: level == "M"? 1: level == "Q"? 2: 3); using(QRCodeGenerator qrGenerator = newQRCodeGenerator) {using(QRCodeData qrCodeData = qrGenerator.CreateQrCode(textBoxQRCode.Text, eccLevel)) {using(QRCode qrCode = newQRCode(qrCodeData)) {

pictureBoxQRCode.BackgroundImage = qrCode.GetGraphic( 20, Color.Black, Color.White, GetIconBitmap, ( int) iconSize.Value);

this.pictureBoxQRCode.Size = newSystem.Drawing.Size(pictureBoxQRCode.Width, pictureBoxQRCode.Height); //Set the SizeMode to center the image.this.pictureBoxQRCode.SizeMode = PictureBoxSizeMode.CenterImage;

pictureBoxQRCode.SizeMode = PictureBoxSizeMode.StretchImage;}}}}

privateBitmap GetIconBitmap( ) {Bitmap img = null; if(iconPath.Text.Length 0) {try{img = newBitmap(iconPath.Text); }catch(Exception) {}}returnimg; }

privatevoidselectIconBtn_Click( objectsender, EventArgs e ) {OpenFileDialog openFileDlg = newOpenFileDialog; openFileDlg.Title = "Select icon"; openFileDlg.Multiselect = false; openFileDlg.CheckFileExists = true; if(openFileDlg.ShowDialog == System.Windows.Forms.DialogResult.OK) {iconPath.Text = openFileDlg.FileName;if(iconSize.Value == 0) {iconSize.Value = 15; }}else{iconPath.Text = ""; }}

privatevoidbtn_save_Click( objectsender, EventArgs e ) {

// Displays a SaveFileDialog so the user can save the ImageSaveFileDialog saveFileDialog1 = newSaveFileDialog; saveFileDialog1.Filter = "Bitmap Image|*.bmp|PNG Image|*.png|JPeg Image|*.jpg|Gif Image|*.gif"; saveFileDialog1.Title = "Save an Image File"; saveFileDialog1.ShowDialog;

// If the file name is not an empty string open it for saving.if(saveFileDialog1.FileName != "") {// Saves the Image via a FileStream created by the OpenFile method.using(FileStream fs = (System.IO.FileStream) saveFileDialog1.OpenFile) {// Saves the Image in the appropriate ImageFormat based upon the// File type selected in the dialog box.// NOTE that the FilterIndex property is one-based.

ImageFormat imageFormat = null; switch(saveFileDialog1.FilterIndex) {case1: imageFormat = ImageFormat.Bmp;break; case2: imageFormat = ImageFormat.Png;break; case3: imageFormat = ImageFormat.Jpeg;break; case4: imageFormat = ImageFormat.Gif;break; default: thrownewNotSupportedException( "File extension is not supported"); }

pictureBoxQRCode.BackgroundImage.Save(fs, imageFormat);fs.Close;}}

}

publicvoidExportToBmp( stringpath ) {

}

privatevoidtextBoxQRCode_TextChanged( objectsender, EventArgs e ) {RenderQrCode;}

privatevoidcomboBoxECC_SelectedIndexChanged( objectsender, EventArgs e ) {RenderQrCode;}}}

掃描二維碼推送至手機(jī)訪問(wèn)。

版權(quán)聲明:本文由飛速云SEO網(wǎng)絡(luò)優(yōu)化推廣發(fā)布,如需轉(zhuǎn)載請(qǐng)注明出處。

本文鏈接:http://m.atlasseeker.com/post/107854.html

“程序代碼生成3d文字(3d編程語(yǔ)言)” 的相關(guān)文章

制作一個(gè)app軟件需要多少錢(qián)(制作APP需要多少錢(qián))

制作一個(gè)app軟件需要多少錢(qián)(制作APP需要多少錢(qián))

今天給各位分享制作一個(gè)app軟件需要多少錢(qián)的知識(shí),其中也會(huì)對(duì)制作APP需要多少錢(qián)進(jìn)行解釋?zhuān)绻芘銮山鉀Q你現(xiàn)在面臨的問(wèn)題,別忘了關(guān)注本站,現(xiàn)在開(kāi)始吧!本文目錄一覽: 1、制作一個(gè)app需要多少錢(qián)? 2、開(kāi)發(fā)一款app軟件需要多少錢(qián)? 3、開(kāi)發(fā)一個(gè)app需多少錢(qián) 4、做一個(gè)APP要花多少錢(qián)...

山東軟件開(kāi)發(fā)(山東軟件開(kāi)發(fā)的學(xué)校有哪些)

山東軟件開(kāi)發(fā)(山東軟件開(kāi)發(fā)的學(xué)校有哪些)

今天給各位分享山東軟件開(kāi)發(fā)的知識(shí),其中也會(huì)對(duì)山東軟件開(kāi)發(fā)的學(xué)校有哪些進(jìn)行解釋?zhuān)绻芘銮山鉀Q你現(xiàn)在面臨的問(wèn)題,別忘了關(guān)注本站,現(xiàn)在開(kāi)始吧!本文目錄一覽: 1、山東做軟件開(kāi)發(fā)的公司哪些好 2、芊芊軟件開(kāi)發(fā)山東有限公司上班怎么樣 3、山東軟件APP開(kāi)發(fā)哪家好? 山東做軟件開(kāi)發(fā)的公司哪些好 山東...

eclipse怎么看項(xiàng)目位置(eclipse怎么看文件位置)

eclipse怎么看項(xiàng)目位置(eclipse怎么看文件位置)

今天給各位分享eclipse怎么看項(xiàng)目位置的知識(shí),其中也會(huì)對(duì)eclipse怎么看文件位置進(jìn)行解釋?zhuān)绻芘銮山鉀Q你現(xiàn)在面臨的問(wèn)題,別忘了關(guān)注本站,現(xiàn)在開(kāi)始吧!本文目錄一覽: 1、導(dǎo)入的項(xiàng)目存放的位置在哪里 eclipse 2、怎么在eclipse中調(diào)試查看項(xiàng)目的運(yùn)行流程 3、eclipse項(xiàng)...

pycharm圣誕樹(shù)源碼教程(圣誕樹(shù)代碼Python)

pycharm圣誕樹(shù)源碼教程(圣誕樹(shù)代碼Python)

今天給各位分享pycharm圣誕樹(shù)源碼教程的知識(shí),其中也會(huì)對(duì)圣誕樹(shù)代碼Python進(jìn)行解釋?zhuān)绻芘銮山鉀Q你現(xiàn)在面臨的問(wèn)題,別忘了關(guān)注本站,現(xiàn)在開(kāi)始吧!本文目錄一覽: 1、pycharm中的圣誕樹(shù)怎么加動(dòng)態(tài)新圖片 2、圣誕樹(shù)python用的是什么曲線 3、如何將pycharm編寫(xiě)的源代碼文件...

游咔破解版(嗶咔破解游戲)

游咔破解版(嗶咔破解游戲)

今天給各位分享游咔破解版的知識(shí),其中也會(huì)對(duì)嗶咔破解游戲進(jìn)行解釋?zhuān)绻芘銮山鉀Q你現(xiàn)在面臨的問(wèn)題,別忘了關(guān)注本站,現(xiàn)在開(kāi)始吧!本文目錄一覽: 1、游咔游戲盒子為什么一直要刷新 2、游咔加載不出來(lái)為什么 3、游咔密碼到底是什么 4、游咔怎么更新 5、游咔游戲盒app打不開(kāi) 游咔游戲盒子...

網(wǎng)頁(yè)源碼獲取什么意思(網(wǎng)站源碼是什么東西)

網(wǎng)頁(yè)源碼獲取什么意思(網(wǎng)站源碼是什么東西)

本篇文章給大家談?wù)劸W(wǎng)頁(yè)源碼獲取什么意思,以及網(wǎng)站源碼是什么東西對(duì)應(yīng)的知識(shí)點(diǎn),希望對(duì)各位有所幫助,不要忘了收藏本站喔。 本文目錄一覽: 1、網(wǎng)頁(yè)里源碼是什么 2、什么是網(wǎng)頁(yè)源代碼? 3、網(wǎng)頁(yè)制作源代碼是什么意思? 4、網(wǎng)頁(yè)源代碼指什么 5、網(wǎng)站的源代碼是什么意思? 6、網(wǎng)頁(yè)源代碼是...