C\#제3자 구성 요 소 를 사용 하여 QR 코드 집합 생 성

5568 단어 C#QR 코드 생 성
C\#QR 코드 를 어떻게 생 성 하 는 지,우 리 는 기 존의 제3자 dll 을 통 해 직접 실현 할 수 있 습 니 다.다음은 몇 가지 서로 다른 생 성 방법 을 보 여 줍 니 다.
1.QrCodeNet(Gma.QrCodeNet.Encoding.dll)을 통 해 구현
1.1):먼저 VS 2015 의 NuGet 을 통 해 해당 하 는 제3자 구성 요 소 를 다운로드 합 니 다.아래 그림 과 같 습 니 다.

1.2):QR 코드 를 구체 적 으로 생 성 하 는 방법 은 다음 과 같다.

    private void GenerateQRByQrCodeNet()
    {
      QrEncoder qrEncoder = new QrEncoder(ErrorCorrectionLevel.H);
      QrCode qrCode = new QrCode();
      qrEncoder.TryEncode("Hello World. This is Eric Sun Testing...", out qrCode);

      GraphicsRenderer renderer = new GraphicsRenderer(new FixedModuleSize(5, QuietZoneModules.Two), Brushes.Black, Brushes.White);

      using (MemoryStream ms = new MemoryStream())
      {
        renderer.WriteToStream(qrCode.Matrix, ImageFormat.Png, ms);
        Image img = Image.FromStream(ms);
        img.Save("E:/csharp-qrcode-net.png");
      }
    }
더 자세 한 정 보 는 다음 링크 를 참고 하 시기 바 랍 니 다.
http://qrcodenet.codeplex.com/
http://stackoverflow.com/questions/7020136/free-c-sharp-qr-code-generator
2.ThoughtWorks.QRcode(ThoughtWorks.QRcode.dll)를 통 해 구현
1.1):먼저 VS 2015 의 NuGet 을 통 해 해당 하 는 제3자 구성 요 소 를 다운로드 합 니 다.아래 그림 과 같 습 니 다.

1.2):QR 코드 를 구체 적 으로 생 성 하 는 방법 은 다음 과 같다.

    private void GenerateQRByThoughtWorks()
    {
      QRCodeEncoder encoder = new QRCodeEncoder();
      encoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE;//    (  :BYTE     ,ALPHA_NUMERIC         )
      encoder.QRCodeScale = 4;//  (               )
      encoder.QRCodeVersion = 0;//  (  :   0                  )
      encoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M;//    、    ( 4   )
      encoder.QRCodeBackgroundColor = Color.Yellow;
      encoder.QRCodeForegroundColor = Color.Green;
      string qrdata = "Hello   ! This is Eric Sun Testing....";

      Bitmap bcodeBitmap = encoder.Encode(qrdata.ToString());
      bcodeBitmap.Save(@"E:\HelloWorld.png", ImageFormat.Png);
      bcodeBitmap.Dispose();
    }
3):Spire.BarCode(Spire.BarCode.dll)를 통 해 구현
1.1):먼저 VS 2015 의 NuGet 을 통 해 해당 하 는 제3자 구성 요 소 를 다운로드 합 니 다.아래 그림 과 같 습 니 다.

1.2):QR 코드 를 구체 적 으로 생 성 하 는 방법 은 다음 과 같다.

    private void GenerateQRBySpire()
    {
      BarcodeSettings bs = new BarcodeSettings()
      {
        Data = "This is qr code.",
        Type = BarCodeType.QRCode,
        TopTextColor = Color.Red,
        ShowCheckSumChar = false,
        ShowText = false
      };
      //Generate the barcode based on the this.barCodeControl1
      BarCodeGenerator generator = new BarCodeGenerator(bs);
      Image barcode = generator.GenerateImage();

      //save the barcode as an image
      barcode.Save(@"E:\barcode-2d.png");
    }
1.3):구체 적 인 바코드 생 성 방법 은 다음 과 같다.

    private void GenerateBarCodeBySpire()
    {
      BarcodeSettings bs = new BarcodeSettings()
      {
        Data = "This is barcode.",
        ShowCheckSumChar = false,
        TopTextColor = Color.Red,
        ShowTopText = false,
        ShowTextOnBottom = true
      };
      //Generate the barcode based on the this.barCodeControl1
      BarCodeGenerator generator = new BarCodeGenerator(bs);
      Image barcode = generator.GenerateImage();

      //save the barcode as an image
      barcode.Save(@"E:\barcode.png");
    }
더 자세 한 정 보 는 다음 링크 를 참고 하 시기 바 랍 니 다.
http://freebarcode.codeplex.com/
http://www.e-iceblue.com/Knowledgebase/Spire.BarCode/Program-Guide/Programme-Guide-for-Spire.BarCode.html
3.바코드 Lib(바코드 Lib.Barcode.ASP.NET.NET.dll)을 통 해 구현
dll 연결 다운로드 http://www.barcodelib.com/asp_net/
4.1):QR 코드 를 구체 적 으로 생 성 하 는 방법 은 다음 과 같다.

    private void GenerateQRByBarcodeLib()
    {
      QRCode qrbarcode = new QRCode();
      qrbarcode.Encoding = QRCodeEncoding.Auto;
      qrbarcode.Data = "336699885522 This is Eric Sun Testing.";

      qrbarcode.ModuleSize = 10;
      qrbarcode.LeftMargin = 8;
      qrbarcode.RightMargin = 8;
      qrbarcode.TopMargin = 8;
      qrbarcode.BottomMargin = 8;
      qrbarcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Gif;

      // Save QR Code barcode image into your system
      qrbarcode.drawBarcode("E:/csharp-qrcode-lib.gif");
    }
4.2):구체 적 인 바코드 생 성 방법 은 다음 과 같다.

    private void GenerateLinearByBarcodeLib()
    {
      Linear barcode = new Linear();
      barcode.Type = BarcodeType.CODE128;
      barcode.Data = "CODE128";
      // other barcode settings.

      // save barcode image into your system
      barcode.drawBarcode("E:/barcode.png");
    }
우리 가 사용 하 는 것 은 시용 판(워 터 마크 가 있 는...)이 고 비용 을 지불 하 는 정품 입 니 다.상세 한 내용 은 다음 과 같은 링크 를 참고 하 시기 바 랍 니 다.
http://www.barcodelib.com/asp_net/

좋은 웹페이지 즐겨찾기