• 大小: 3.39MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-27
  • 语言: C#
  • 标签: c#  二维码  

资源简介

c# 二维码名片源码及相应的qrcode.dll 此程序是vs2010版,winform程序,但经过学习借鉴使用,完全可以用在web开发上。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.ComponentModel;
using System.Data;
using ThoughtWorks.QRCode.Codec;
using ThoughtWorks.QRCode.Codec.Data;
using System.IO;

namespace POS.Common
{
    public class QRCode
    {
        /// 
        /// 生成二维码
        /// 

        /// 
        /// 保存路径(可为空如有指定地址建议后缀为jpg格式)
        /// 编码模式包括A、B、N,默认为B
        /// 纠错率包括L(7%)、M(15%)、Q(25%)和H(30%)默认为M级
        /// 版本号介于1-40.版本越高信息容量越大默认设为8
        /// 比例默认4
        /// 返回二维码生成地址
        public static string CreateQRCode(string contentstring path=““ string qrCodeEncodeMode=“B“ string qrCodeErrorCorrect=“M“ int qrCodeVersion=8 int qrCodeScale=4)
        {
            Image image = CreateQRCode(content qrCodeEncodeMode qrCodeErrorCorrect qrCodeVersion qrCodeScale);

            string filepath = string.Empty;
            if (!string.IsNullOrEmpty(path))
            {
                string strpath = path.Substring(0 path.LastIndexOf(‘\\‘));
                if (!Directory.Exists(strpath))
                {
                    Directory.CreateDirectory(strpath);
                }
                filepath = path;
            }
            else
            {
                filepath = Application.StartupPath + “\\QRCode“ + “\\“;
                if (!Directory.Exists(filepath))
                    Directory.CreateDirectory(filepath);

                filepath = filepath + DateTime.Now.ToString(“yyyymmddhhmmssfff“).ToString() + “.jpg“;
            }

            FileStream fs = new FileStream(filepath FileMode.OpenOrCreate FileAccess.Write);
            image.Save(fs System.Drawing.Imaging.ImageFormat.Jpeg);

            fs.Close();
            image.Dispose();

            return filepath;
        }

        /// 
        /// 生成二维码
        /// 

        /// 
        /// 保存路径(可为空如有指定地址建议后缀为jpg格式)
        /// 编码模式包括A、B、N,默认为B
        /// 纠错率包括L(7%)、M(15%)、Q(25%)和H(30%)默认为M级
        /// 版本号介于1-40.版本越高信息容量越大默认设为8
        /// 比例默认4
        /// 
        public static Image CreateQRCode(string content string qrCodeEncodeMode = “B“ string qrCodeErrorCorrect = “M“ int qrCodeVersion = 8 int qrCodeScale = 4)
        {
            QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();

            qrCodeEncodeMode = qrCodeEncodeMode.ToUpper();
            switch (qrCodeEncodeMode)
            {
 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     108032  2013-03-03 09:35  QrCode.Net 0.4 Pre-Release\QrCode.Net 0.4 Pre-Release\Gma.QrCodeNet.Encoder\Gma.QrCodeNet.Encoding.dll

     文件     413184  2013-03-03 09:35  QrCode.Net 0.4 Pre-Release\QrCode.Net 0.4 Pre-Release\Gma.QrCodeNet.Encoder\Gma.QrCodeNet.Encoding.pdb

     文件      61972  2013-03-03 09:35  QrCode.Net 0.4 Pre-Release\QrCode.Net 0.4 Pre-Release\Gma.QrCodeNet.Encoder\Gma.QrCodeNet.Encoding.xml

     文件     108032  2013-03-03 09:35  QrCode.Net 0.4 Pre-Release\QrCode.Net 0.4 Pre-Release\Gma.QrCodeNet.Encoding.Net35\Gma.QrCodeNet.Encoding.Net35.dll

     文件     413184  2013-03-03 09:35  QrCode.Net 0.4 Pre-Release\QrCode.Net 0.4 Pre-Release\Gma.QrCodeNet.Encoding.Net35\Gma.QrCodeNet.Encoding.Net35.pdb

     文件      61978  2013-03-03 09:35  QrCode.Net 0.4 Pre-Release\QrCode.Net 0.4 Pre-Release\Gma.QrCodeNet.Encoding.Net35\Gma.QrCodeNet.Encoding.Net35.xml

     文件     107520  2013-03-03 09:35  QrCode.Net 0.4 Pre-Release\QrCode.Net 0.4 Pre-Release\Gma.QrCodeNet.Encoding.Net45\Gma.QrCodeNet.Encoding.Net45.dll

     文件     411136  2013-03-03 09:35  QrCode.Net 0.4 Pre-Release\QrCode.Net 0.4 Pre-Release\Gma.QrCodeNet.Encoding.Net45\Gma.QrCodeNet.Encoding.Net45.pdb

     文件      60530  2013-03-03 09:35  QrCode.Net 0.4 Pre-Release\QrCode.Net 0.4 Pre-Release\Gma.QrCodeNet.Encoding.Net45\Gma.QrCodeNet.Encoding.Net45.xml

     文件      75264  2013-03-03 09:36  QrCode.Net 0.4 Pre-Release\QrCode.Net 0.4 Pre-Release\Gma.QrCodeNet.Encoding.Silverlight\Gma.QrCodeNet.Encoding.Silverlight.dll

     文件     308736  2013-03-03 09:36  QrCode.Net 0.4 Pre-Release\QrCode.Net 0.4 Pre-Release\Gma.QrCodeNet.Encoding.Silverlight\Gma.QrCodeNet.Encoding.Silverlight.pdb

     文件      34091  2013-03-03 09:36  QrCode.Net 0.4 Pre-Release\QrCode.Net 0.4 Pre-Release\Gma.QrCodeNet.Encoding.Silverlight\Gma.QrCodeNet.Encoding.Silverlight.xml

     文件      95744  2013-03-03 09:36  QrCode.Net 0.4 Pre-Release\QrCode.Net 0.4 Pre-Release\Gma.QrCodeNet.Encoding.WinRT\x86\Gma.QrCodeNet.Encoding.WinRT.dll

     文件     361984  2013-03-03 09:36  QrCode.Net 0.4 Pre-Release\QrCode.Net 0.4 Pre-Release\Gma.QrCodeNet.Encoding.WinRT\x86\Gma.QrCodeNet.Encoding.WinRT.pdb

     文件       1624  2013-03-03 09:27  QrCode.Net 0.4 Pre-Release\QrCode.Net 0.4 Pre-Release\Gma.QrCodeNet.Encoding.WinRT\x86\Gma.QrCodeNet.Encoding.WinRT.pri

     文件      39709  2013-03-03 09:36  QrCode.Net 0.4 Pre-Release\QrCode.Net 0.4 Pre-Release\Gma.QrCodeNet.Encoding.WinRT\x86\Gma.QrCodeNet.Encoding.WinRT.xml

     文件       1196  2013-03-02 14:07  QrCode.Net 0.4 Pre-Release\QrCode.Net 0.4 Pre-Release\Gma.QrCodeNet.Encoding.WinRT\x86\Themes\Generic.xaml

     文件        117  2016-10-31 15:22  TwoDimensionCodeNameCard\TwoDimensionCodeNameCard\app.config

     文件       1748  2015-07-04 19:44  TwoDimensionCodeNameCard\TwoDimensionCodeNameCard\Apps-tux-icon.png

     文件    6205440  2010-12-04 14:18  TwoDimensionCodeNameCard\TwoDimensionCodeNameCard\bin\Debug\ThoughtWorks.QRCode.dll

     文件        117  2016-10-31 15:22  TwoDimensionCodeNameCard\TwoDimensionCodeNameCard\bin\Debug\TwoDimensionCode.exe.config

     文件      11608  2016-10-31 15:22  TwoDimensionCodeNameCard\TwoDimensionCodeNameCard\bin\Debug\TwoDimensionCode.vshost.exe

     文件        117  2016-10-31 15:22  TwoDimensionCodeNameCard\TwoDimensionCodeNameCard\bin\Debug\TwoDimensionCode.vshost.exe.config

     文件        490  2010-03-17 22:39  TwoDimensionCodeNameCard\TwoDimensionCodeNameCard\bin\Debug\TwoDimensionCode.vshost.exe.manifest

     文件      17920  2016-10-28 17:57  TwoDimensionCodeNameCard\TwoDimensionCodeNameCard\bin\Debug\TwoDimensionCodeNameCard.exe

     文件      28160  2016-10-28 17:57  TwoDimensionCodeNameCard\TwoDimensionCodeNameCard\bin\Debug\TwoDimensionCodeNameCard.pdb

     文件        490  2010-03-17 22:39  TwoDimensionCodeNameCard\TwoDimensionCodeNameCard\bin\Debug\TwoDimensionCodeNameCard.vshost.exe.manifest

     文件       5264  2016-10-31 15:21  TwoDimensionCodeNameCard\TwoDimensionCodeNameCard\Form1.cs

     文件      10226  2016-10-31 15:03  TwoDimensionCodeNameCard\TwoDimensionCodeNameCard\Form1.Designer.cs

     文件       6427  2016-10-31 15:03  TwoDimensionCodeNameCard\TwoDimensionCodeNameCard\Form1.resx

............此处省略51个文件信息

评论

共有 条评论