[C#] 纯文本查看 复制代码
/// <summary>
/// QcImage 的摘要说明
/// </summary>
public class QcImage : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "image/png";
QrEncoder qrEncoder = new QrEncoder(ErrorCorrectionLevel.Q);
var content = "这里写内容就行了";
QrCode qrCode = qrEncoder.Encode(content);
DrawingBrushRenderer dRenderer = new DrawingBrushRenderer(new FixedModuleSize(6, QuietZoneModules.Zero));
MemoryStream ms = new MemoryStream();
dRenderer.WriteToStream(qrCode.Matrix, ImageFormatEnum.PNG, ms);
context.Response.BinaryWrite(ms.ToArray());
}
public bool IsReusable
{
get
{
return false;
}
}
}