You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.6 KiB
C#

9 months ago
using POS.Language.Language;
using QRCoder;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace POSV.Member
{
public partial class WeixinBindCardForm : BusinessForm
{
private string wxBrinUrl = "";
public WeixinBindCardForm(string brinUrl)
{
InitializeComponent();
this.wxBrinUrl = brinUrl;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
InstallQR();
}
private void InstallQR()
{
Bitmap bitmap = null;
QRCodeGenerator.ECCLevel eccLevel = QRCodeGenerator.ECCLevel.Q;
using (QRCodeGenerator qrGenerator = new QRCodeGenerator())
{
using (QRCodeData qrCodeData = qrGenerator.CreateQrCode(wxBrinUrl, eccLevel))
{
using (QRCode qrCode = new QRCode(qrCodeData))
{
bitmap = qrCode.GetGraphic(10, Color.Black, Color.White, false);
}
}
}
if (bitmap != null)
{
qrPanel.BackgroundImageLayout = ImageLayout.Zoom;
qrPanel.Style.BackgroundImage = bitmap;
qrPanel.Invalidate();
}
else
{
ShowToastNotify(this,LangProxy.ToLang( "二维码生成失败!"));
}
}
}
}