• 大小: 0.98M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2024-06-17
  • 语言: C#
  • 标签: 二维码  生成  解码  

资源简介

生成二维码,支持中文汉字,指定二维码中间logo

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms;
using System.Runtime.InteropServices;

using ThoughtWorks.QRCode.Codec;
using ThoughtWorks.QRCode.Codec.Data;
using ThoughtWorks.QRCode.Codec.Util;
using System.IO;

namespace 二维码测试
{
    public partial class Form1 : Form
    {
        private const long WM_GETMINMAXINFO = 0x24;

        public struct POINTAPI
        {
            public int x;
            public int y;
        }

        public struct MINMAXINFO
        {
            public POINTAPI ptReserved;
            public POINTAPI ptMaxSize;
            public POINTAPI ptMaxPosition;
            public POINTAPI ptMinTrackSize;
            public POINTAPI ptMaxTrackSize;
        }
        public Form1()
        {
            InitializeComponent();
            this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width Screen.PrimaryScreen.WorkingArea.Height);
            cbVersion.Text = “7“;
            cbEncoding.Text = “Byte“;
            cbCorrectionLevel.Text = “M“;
            txtData.Text = “请输入数据内容...“;  
            cbScale.Text = “5“;
     
        }

        private void Form1_Load(object sender EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;    //最大化窗体
        }
        //protected override void WndProc(ref System.Windows.Forms.Message m)
        //{
        //    base.WndProc(ref m);
        //    if (m.Msg == WM_GETMINMAXINFO)
        //    {
        //        MINMAXINFO mmi = (MINMAXINFO)m.GetLParam(typeof(MINMAXINFO));
        //        mmi.ptMinTrackSize.x = this.MinimumSize.Width;
        //        mmi.ptMinTrackSize.y = this.MinimumSize.Height;
        //        if (this.MaximumSize.Width != 0 || this.MaximumSize.Height != 0)
        //        {
        //            mmi.ptMaxTrackSize.x = this.MaximumSize.Width;
        //            mmi.ptMaxTrackSize.y = this.MaximumSize.Height;
        //        }
        //        mmi.ptMaxPosition.x = 1;
        //        mmi.ptMaxPosition.y = 1;

        //        System.Runtime.InteropServices.Marshal.StructureToPtr(mmi m.LParam true);
        //    }
        //}
        /// 
        /// 生成二维码
        /// 

        /// 
        /// 
        private void button1_Click(object sender EventArgs e)
        {
           
            string encoding = cbEncoding.Text;
            string correctionLever = cbCorrectionLevel.Text;
            int version = Convert.ToInt32(cbVersion.Text);
            int scale = Convert.ToInt32(cbScale.Text);
            string data = txtData.Text.Trim();
            if (data == string.Empty)
            {
                MessageBox.Show(“请输入数据!““警告“ MessageBoxButtons.OK MessageBoxIcon.Warning);
                re

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-12-19 16:16  二维码测试\
     目录           0  2020-12-19 16:16  二维码测试\.vs\
     目录           0  2020-12-19 16:16  二维码测试\.vs\二维码测试\
     目录           0  2020-12-19 16:16  二维码测试\.vs\二维码测试\v14\
     文件       27648  2020-12-19 17:52  二维码测试\.vs\二维码测试\v14\.suo
     目录           0  2020-12-19 17:50  二维码测试\二维码测试\
     文件         887  2020-12-19 17:53  二维码测试\二维码测试.sln
     文件       20480  2019-10-23 16:04  二维码测试\二维码测试.suo
     文件         134  2020-12-19 17:49  二维码测试\二维码测试\app.config
     目录           0  2019-04-20 16:04  二维码测试\二维码测试\bin\
     目录           0  2020-12-19 17:49  二维码测试\二维码测试\bin\Debug\
     文件     6209536  2012-03-25 12:12  二维码测试\二维码测试\bin\Debug\ThoughtWorks.QRCode.dll
     文件       16896  2020-12-19 17:50  二维码测试\二维码测试\bin\Debug\二维码测试.exe
     文件         134  2020-12-19 17:49  二维码测试\二维码测试\bin\Debug\二维码测试.exe.config
     文件       26112  2020-12-19 17:50  二维码测试\二维码测试\bin\Debug\二维码测试.pdb
     文件       21688  2020-12-19 17:50  二维码测试\二维码测试\bin\Debug\二维码测试.vshost.exe
     文件         134  2020-12-19 17:49  二维码测试\二维码测试\bin\Debug\二维码测试.vshost.exe.config
     文件         490  2019-03-19 12:46  二维码测试\二维码测试\bin\Debug\二维码测试.vshost.exe.manifest
     文件       11602  2020-12-19 17:50  二维码测试\二维码测试\Form1.cs
     文件       15471  2019-10-23 16:03  二维码测试\二维码测试\Form1.Designer.cs
     文件        6397  2019-10-23 16:03  二维码测试\二维码测试\Form1.resx
     目录           0  2019-04-20 16:04  二维码测试\二维码测试\obj\
     目录           0  2019-04-20 16:04  二维码测试\二维码测试\obj\x86\
     目录           0  2020-12-19 17:50  二维码测试\二维码测试\obj\x86\Debug\
     文件        3228  2020-12-19 17:49  二维码测试\二维码测试\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        6332  2020-12-19 17:50  二维码测试\二维码测试\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     目录           0  2020-12-19 17:49  二维码测试\二维码测试\obj\x86\Debug\TempPE\
     文件        3584  2020-12-19 17:49  二维码测试\二维码测试\obj\x86\Debug\TempPE\Properties.Resources.Designer.cs.dll
     文件        3137  2020-12-19 17:50  二维码测试\二维码测试\obj\x86\Debug\二维码测试.csproj.FileListAbsolute.txt
     文件         847  2020-12-19 17:50  二维码测试\二维码测试\obj\x86\Debug\二维码测试.csproj.GenerateResource.Cache
     文件       24816  2020-12-19 17:49  二维码测试\二维码测试\obj\x86\Debug\二维码测试.csprojResolveAssemblyReference.cache
............此处省略12个文件信息

评论

共有 条评论