c#二维码生成的代码分享
时间:2022-11-28 15:19:37
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// 调用外网API 生成二维码 周祥 2013年11月12日10:54:38
/// </summary>
public class Qr
{
public Qr()
{
//
//TODO: 在此处添加构造函数逻辑
//
}
/*
bg 背景颜色 bg=颜色代码,例如:bg=ffffff
fg 前景颜色 fg=颜色代码,例如:fg=cc0000
gc 渐变颜色 gc=颜色代码,例如:gc=cc00000
el 纠错等级 el可用值:h\q\m\l,例如:el=h
w 尺寸大小 w=数值(像素),例如:w=300
m 静区(外边距) m=数值(像素),例如:m=30
pt 定位点颜色(外框) pt=颜色代码,例如:pt=00ff00
inpt 定位点颜色(内点) inpt=颜色代码,例如:inpt=000000
logo logo图片 logo=图片地址,例如:logo=http://www.xxx.cn/logo.png
*/
public const string api = "http://qr.liantu.com/api.php";
/// <summary>
/// 根据URL和参数 返回地址
/// </summary>
/// <param name="name"></param>
/// <param name="tel"></param>
/// <param name="email"></param>
/// <param name="logo"></param>
/// <returns></returns>
public static string GenerationCard(string name, string tel, string email, string logo = "")
{
string RequestUrl = api;
string mecard = "MECARD:N:" + name + ";TEL:" + tel + ";EMAIL:" + email + ";";
RequestUrl += "?text=" + mecard;
if (logo != "")
{
RequestUrl += "&logo=" + logo;
}
return RequestUrl;
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="QrImg.aspx.cs" Inherits="QrImg" %>
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
详解Java中Iterable与Iterator用法
java中对象调用成员变量与成员实例方法
![](https://img.aspxhome.com/file/2023/4/71944_0s.png)
java多线程之停止线程的方法实例代码详解
Unity 使用TexturePacker打包图集的操作方法
![](https://img.aspxhome.com/file/2023/4/83264_0s.jpg)
关于Feign调用服务Headers传参问题
![](https://img.aspxhome.com/file/2023/5/71025_0s.jpg)
springBoot解决static和@Component遇到的bug
一文搞懂Spring循环依赖的原理
Springboot整合Netty实现RPC服务器的示例代码
IDEA + Maven环境下的SSM框架整合及搭建过程
![](https://img.aspxhome.com/file/2023/3/58423_0s.jpg)
Springboot基于websocket实现简单在线聊天功能
Java Swing JLabel标签的使用方法
![](https://img.aspxhome.com/file/2023/3/68573_0s.jpg)
C#数据结构之堆栈(Stack)实例详解
![](https://img.aspxhome.com/file/2023/4/80024_0s.png)
美化java代码,从合理注释开始
Java中static静态变量的初始化完全解析
java遍历读取xml文件内容
Android中TextureView与SurfaceView用法区别总结
![](https://img.aspxhome.com/file/2023/2/101852_0s.jpg)
C#实现字符串进制转换方法汇总
Struts2拦截器登录验证实例
![](https://img.aspxhome.com/file/2023/5/84185_0s.png)