当前位置:网站首页>[recommended by bloggers] C # generate a good-looking QR code (with source code)
[recommended by bloggers] C # generate a good-looking QR code (with source code)
2022-07-06 10:53:00 【xcLeigh】
List of articles
【 Bloggers recommend 】C# Generate a good-looking QR code ( Source code attached )
- Realization function
1. Realize two-dimensional code generation
2. Realize QR code style modification
3. Under the condition of realization , Batch build
4. Implementation style , Address and other parameters can be configured
1. Effect display
1.1 Interface effect
1.2 Interface effect after generation
1.1 QR code generated after interface configuration
2. QR code page design
<div style="background-color:white;width:100%; text-align:center;">
<div class="layui-field-box" style="background-color:orange;">
<div>
<table style="width:100%;">
<tr>
<td style="color:black;">
xcLeigh - QR code generation
</td>
<td style="text-align:right;font-size:13px;color:white;">
<a href="https://download.csdn.net/user/weixin_43151418/?spm=1003.2020.3001.5449">【 Bloggers recommend 】 Related resources </a> |
<a href="https://download.csdn.net/download/weixin_43151418/85329413?spm=1003.2166.3001.6637.6">C#MVC Background management system ( Source code attached )</a> |
<a href="https://download.csdn.net/download/weixin_43151418/85337361?spm=1003.2166.3001.6637.1">html Drop down tree ( Attached is a nice login interface )</a> |
<a href="https://download.csdn.net/download/weixin_43151418/85335759">HTML5 Responsive mobile wechat ( Source code attached )</a> |
<a href="https://download.csdn.net/download/weixin_43151418/85336631">html operation SVG chart ( Source code attached )</a>
</td>
</tr>
</table>
</div>
</div>
<hr style="margin:0px;padding:0px;margin-bottom:5px;" />
@*<div style="text-align:center; padding:15px;color:red;">
<span id="tomessage"> Conversion success , Position in D:\\</span>
</div>*@
<div class="layui-upload-drag" id="zjImg" style="margin-bottom:5px;">
<img id="ewmImg" name="ewmImg" src="~/Content/xcsharp/images/lo.png" style="width:80px;height:80px;" />
<div style="padding:2px;"></div>
<p style="color:crimson;"> QR code Logo</p>
</div>
<input id="ewmImgt" name="ewmImgt" hidden="hidden" type="text" value="Content\\xcsharp\\images\\lo.png">
<div class="layui-upload-drag" id="scImg" style="margin-bottom:5px;display:none;">
<img class="img1" src="@ViewBag.ImgScEwm" style="width:150px;height:150px;" />
<div style="padding:2px;"></div>
<p style="color:crimson;"> Generate successfully </p>
<p style="color:crimson;"> Right click to save the picture as , Save QR code </p>
</div>
<div style="text-align:left; margin:10px;">
<input id="ewmAddr" name="ewmAddr" class="layui-input" type="text" placeholder=" QR code definition : It can be an address , It can be a specific character " autocomplete="off" lay-verify="required" lay-reqtext=" QR code definition is required , How can it be empty ?">
</div>
<div style="text-align:left; margin:10px;">
<input id="ewmWz" name="ewmWz" class="layui-input" type="text" placeholder=" The bottom text can be added or not , The longest 8 Characters " maxlength="8" autocomplete="off">
</div>
<div style="text-align:left; margin:10px;">
<table>
<tr>
<td> Background color :</td>
<td>
<div style="margin-top:18px;">
<div class="layui-form-item">
<div class="layui-input-inline" style="width: 120px;">
<input type="text" value="#ffffff" placeholder=" The background color " readonly="readonly" class="layui-input" id="ewmBgColor" name="ewmBgColor">
</div>
<div class="layui-inline" style="left: -11px;">
<div id="ewmBgColor_d"></div>
</div>
</div>
</div>
</td>
<td> QR code color :</td>
<td>
<div style="margin-top:18px;">
<div class="layui-form-item">
<div class="layui-input-inline" style="width: 120px;">
<input type="text" value="#1EABFC" placeholder=" The background color " readonly="readonly" class="layui-input" id="ewmColor" name="ewmColor">
</div>
<div class="layui-inline" style="left: -11px;">
<div id="ewmColor_d"></div>
</div>
</div>
</div>
</td>
<td> Text color :</td>
<td>
<div style="margin-top:18px;">
<div class="layui-form-item">
<div class="layui-input-inline" style="width: 120px;">
<input type="text" value="#1EABFC" placeholder=" The background color " readonly="readonly" class="layui-input" id="ewmFontColor" name="ewmFontColor">
</div>
<div class="layui-inline" style="left: -11px;">
<div id="ewmFontColor_d"></div>
</div>
</div>
</div>
</td>
<td> Text font :</td>
<td>
<select name="ewmWzFont" lay-filter="aihao">
<option value=" In black " selected=""> In black </option>
<option value=" Song style "> Song style </option>
<option value=" Imitation song "> Imitation song </option>
</select>
</td>
<td style="padding-left:20px;"> Four corner color :</td>
<td>
<div style="margin-top:18px;">
<div class="layui-form-item">
<div class="layui-input-inline" style="width: 120px;">
<input type="text" value="#1EABFC" placeholder=" The background color " readonly="readonly" class="layui-input" id="ewmSgjColor" name="ewmSgjColor">
</div>
<div class="layui-inline" style="left: -11px;">
<div id="ewmSgjColor_d"></div>
</div>
</div>
</div>
</td>
</tr>
</table>
</div>
<div style="text-align:left; margin:10px;">
<table>
<tr>
<td> Whether to display four corners :</td>
<td>
<input name="ewmSgj" type="checkbox" checked="" lay-skin="switch" lay-filter="switchTest" lay-text=" Show | hide ">
</td>
<td></td>
</tr>
</table>
</div>
<div style="text-align:left; margin:10px;">
<button class="layui-btn" data-type="parseTable" type="submit" lay-filter="demo1" lay-submit=""> Generate qr code </button>
</div>
@*<div class="layui-upload-drag" id="wordtopdf" style="margin-bottom:5px;">
<i class="layui-icon"></i>
<p style="color:crimson;">WORD turn PDF(doc Format )</p>
<p> Click upload , Or drag the file here </p>
</div>*@
</div>
3. Background operation of QR code generation
public ActionResult EwmImg() {
try
{
var file = Request.Files[0]; // Get the selected file
var filecombin = file.FileName.Split('.');
// File name
string filename = Path.GetFileName(file.FileName);
if (file == null || filename.IndexOf("&") != -1 || String.IsNullOrEmpty(file.FileName) || file.ContentLength == 0 || filecombin.Length < 2)
{
return Json(new
{
fileid = 0,
src = "",
name = "",
msg = " Upload error Please check the file name or Whether the image format conforms to "
});
}
// Define the local path location
string local = "upload\\ewm\\img\\";
string localPath = Path.Combine(HttpRuntime.AppDomainAppPath, local);
if (!System.IO.Directory.Exists(localPath))
System.IO.Directory.CreateDirectory(localPath);
string newPath = localPath + filename;
file.SaveAs(newPath);
// Save the picture
return Json(new
{
src = newPath.Trim().Replace("\\", "|"),
name = filename,
// Get file name without suffix
msg = " Upload successful "
});
}
catch { }
return Json(new
{
src = "",
name = "", // Get file name without suffix
msg = " Upload error "
});
}
4. Source download
【 Bloggers recommend 】C# Generate a good-looking QR code ( Source code )
边栏推荐
- MySQL20-MySQL的数据目录
- MySQL35-主从复制
- 虚拟机Ping通主机,主机Ping不通虚拟机
- How to change php INI file supports PDO abstraction layer
- Transactions have four characteristics?
- npm一个错误 npm ERR code ENOENT npm ERR syscall open
- Mysql22 logical architecture
- Bytetrack: multi object tracking by associating every detection box paper reading notes ()
- MySQL22-逻辑架构
- Water and rain condition monitoring reservoir water and rain condition online monitoring
猜你喜欢
MySQL21-用户与权限管理
MySQL 20 MySQL data directory
【C语言】深度剖析数据存储的底层原理
[unity] simulate jelly effect (with collision) -- tutorial on using jellysprites plug-in
Installation and use of MySQL under MySQL 19 Linux
Mysql35 master slave replication
Water and rain condition monitoring reservoir water and rain condition online monitoring
Idea import / export settings file
Emotional classification of 1.6 million comments on LSTM based on pytoch
【博主推荐】SSM框架的后台管理系统(附源码)
随机推荐
Unicode decodeerror: 'UTF-8' codec can't decode byte 0xd0 in position 0 successfully resolved
Postman uses scripts to modify the values of environment variables
Timestamp with implicit default value is deprecated error in MySQL 5.6
MySQL28-数据库的设计规范
MySQL25-索引的创建与设计原则
In fact, the implementation of current limiting is not complicated
How to change php INI file supports PDO abstraction layer
Mysql21 user and permission management
Windows cannot start the MySQL service (located on the local computer) error 1067 the process terminated unexpectedly
【博主推荐】C#MVC列表实现增删改查导入导出曲线功能(附源码)
What is the difference between TCP and UDP?
基于Pytorch肺部感染识别案例(采用ResNet网络结构)
Navicat 导出表生成PDM文件
Pytorch LSTM实现流程(可视化版本)
Invalid global search in idea/pychar, etc. (win10)
MySQL flush operation
Isn't there anyone who doesn't know how to write mine sweeping games in C language
IDEA 导入导出 settings 设置文件
基于Pytorch的LSTM实战160万条评论情感分类
Mysql23 storage engine