LoginSignup
1
2

More than 3 years have passed since last update.

QRCodeEncoderDecoderLibraryを用いてQRコードをエンコードする(作成する)Csharpの単体アプリを作る

Last updated at Posted at 2019-03-22

QRCodeEncoderDecoderLibraryを用いてQRコードをエンコードする(作成する)Csharpの単体アプリを作る

※ライブラリは以下参照
QR Code Encoder and Decoder .NET Class Library
https://www.codeproject.com/Articles/1250071/QR-Code-Encoder-and-Decoder-NET-Class-Library-Writ

QRCodeEncoderDecoderLibrary.dll
QRCodeEncoderDecoderLibrary.dll

sample_qr_encode.cs

//c:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /reference:QRCodeEncoderDecoderLibrary.dll /target:winexe sample_qr_encode.cs

using System;
using System.Windows.Forms;
using System.Drawing;
using QRCodeEncoderDecoderLibrary;

public class sample_qr_encode
{
 public static void Main(string[] args)
 {

    string str;
    str = @"" + args[0];

    QREncoder QRCodeEncoder;
    Bitmap    QRCodeImage;

    QRCodeEncoder = new QREncoder();

    byte [] bytesData = System.Text.Encoding.UTF8.GetBytes(str);
    string Data = System.Text.Encoding.UTF8.GetString(bytesData);

    QRCodeEncoder.Encode(ErrorCorrection.H, Data);
    QRCodeImage = QRCodeToBitmap.CreateBitmap(QRCodeEncoder, 4, 8);

    QRCodeImage.Save(@".\\outQR.png",System.Drawing.Imaging.ImageFormat.Png);

 }
}

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2