In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to use C # to generate the QR code in DataMatrix format". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to use C # to generate the QR code in DataMatrix format".
1. Attachment is dll
2. Use the above controls to generate the core code of the QR code:
(a) C # code:
DataMatrix datamatrix = new DataMatrix (); datamatrix.Data = "0123456789"; / / Create DataMatrix and encode barcode to Jpeg format datamatrix.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg; datamatrix.drawBarcode ("C://csharp-datamatrix.jpg")
(B) VB.NET code:
Dim datamatrix As OnBarcode.Barcode.DataMatrix datamatrix = New OnBarcode.Barcode.DataMatrix () datamatrix.Data = "0123456789" 'Create DataMatrix and encode barcode to Jpeg format datamatrix.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg datamatrix.drawBarcode ("C://vbnet-datamatrix.jpg")
(C) other function interfaces (C # and VB, respectively):
Public void drawBarcode (Graphics graphics); public void drawBarcode (string filename); public Bitmap drawBarcode (); public void drawBarcode (Stream fileStream); Public Sub drawBarcode (ByRef graphics As Graphics) Public Sub drawBarcode (ByVal filename As String) Public Function drawBarcode () As Bitmap Public Sub drawBarcode (ByRef fileStream As Stream)
3. Practice part:
Create the following interface: press the button to produce the bar code.
Using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms; using OnBarcode.Barcode;using System.Drawing.Imaging; namespace DataMatrix1 {public partial class Form1: Form {public Form1 () {InitializeComponent ();} private void button1_Click (object sender, EventArgs e) {DataMatrix datamatrix = new DataMatrix () / / Barcode data to encode datamatrix.Data = "OnBarcode"; / / DataMatrix data mode datamatrix.DataMode = DataMatrixDataMode.ASCII; / / DataMatrix format mode datamatrix.FormatMode = DataMatrixFormatMode.Format_10X10; / * * Barcode Image Related Settings * / / Unit of meature for all size related setting in the library. Datamatrix.UOM = UnitOfMeasure.PIXEL; / / Bar module size (X), default is 3 pixel; datamatrix.X = 3; / / Barcode image left, right, top, bottom margins. Defaults are 0. Datamatrix.LeftMargin = 0; datamatrix.RightMargin = 0; datamatrix.TopMargin = 0; datamatrix.BottomMargin = 0; / / Image resolution in dpi, default is 72 dpi. Datamatrix.Resolution = 72; / / Created barcode orientation. / / Rotate0 = 0, / / Rotate90 = 1, / / Rotate180 = 2, / / Rotate270 = 3, / / 4 options are: facing left, facing right, facing bottom, and facing top datamatrix.Rotate = Rotate.Rotate0; / / Geneat datamatrix and encode barcode to gif format datamatrix.ImageFormat = System.Drawing.Imaging.ImageFormat.Bmp Datamatrix.drawBarcode ("C:\\ datamatrix.jpg"); / / produce the QR code / / You can also call other drawing methods to generate barcodes / / public void drawBarcode (Graphics graphics) by saving a specific format; / / public void drawBarcode (string filename); / / public Bitmap drawBarcode (); / / public void drawBarcode (Stream stream) / / write the encoded format to this.pictureBox1.Image = datamatrix.drawBarcode () in the file stream; / / call one of the interfaces to display the picture in bitmap form}
Test results:
Thank you for your reading, the above is "how to use C # to generate DataMatrix format QR code" content, after the study of this article, I believe you on how to use C # to generate DataMatrix format QR code this problem has a deeper understanding, the specific use of the need for you to practice and verify. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.