c qr code generation code sharing
- 2020-05-27 06:58:43
- OfStack
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Call the network API generate 2 D code A lot 2013 years 11 month 12 day 10:54:38
/// </summary>
public class Qr
{
public Qr()
{
//
//TODO: Add the constructor logic here
//
}
/*
bg The background color bg= Color code, such as: bg=ffffff
fg The foreground color fg= Color code, such as: fg=cc0000
gc The gradient color gc= Color code, such as: gc=cc00000
el Error correction level el Available value: h\q\m\l , such as: el=h
w The size w= Values (pixels), such as: w=300
m Quiet area (margin) m= Values (pixels), such as: m=30
pt Color of registration point (frame) pt= Color code, such as: pt=00ff00
inpt Color of registration point (inner point) inpt= Color code, such as: inpt=000000
logo logo The picture logo= Image address, e.g. : logo=http://www.xxx.cn/logo.png
*/
public const string api = "http://qr.liantu.com/api.php";
/// <summary>
/// According to the URL And parameters The return address
/// </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" %>