Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cheng5x/YcQrCode
码晒客/疯狂创意二维码,底层 ,模版制作开源
https://github.com/cheng5x/YcQrCode
Last synced: 3 months ago
JSON representation
码晒客/疯狂创意二维码,底层 ,模版制作开源
- Host: GitHub
- URL: https://github.com/cheng5x/YcQrCode
- Owner: cheng5x
- License: gpl-2.0
- Created: 2014-06-06T05:50:20.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-06-06T11:09:58.000Z (about 10 years ago)
- Last Synced: 2024-03-01T01:00:28.571Z (4 months ago)
- Language: C#
- Size: 1.77 MB
- Stars: 26
- Watchers: 12
- Forks: 31
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-stars - YcQrCode - 码晒客/疯狂创意二维码,底层 ,模版制作开源 (C#)
README
YcQrCode
========码晒客/疯狂创意二维码,底层 ,模版制作开源
public override Bitmap Encode(string content)
{
try
{
matrix = QrCodeEncoder.calQrcode(EnCoding.GetBytes(content));
}
catch { throw new Exception("内容超出范围,请选择更高版本或者降低容错率"); }this.SetParam();
//SolidBrush Backbrush = new SolidBrush(QrCodeEncoder.QRCodeBackgroundColor);
SolidBrush Backbrush = new SolidBrush(Color.Transparent);//背景透明
SolidBrush Forebrush = new SolidBrush(QrCodeEncoder.QRCodeForegroundColor);Bitmap image = new Bitmap(this.QrCodeW, this.QrCodeH);
Graphics g = Graphics.FromImage(image);Rectangle rect = new Rectangle();
g.FillRectangle(Backbrush, new Rectangle(0, 0, image.Width, image.Height));
for (int i = 0; i < matrix.Length; i++)
{
for (int j = 0; j < matrix.Length; j++)
{
rect = new Rectangle((j + this.SpacingW) * QrCodeEncoder.QRCodeScale, (i + this.SpacingH) * QrCodeEncoder.QRCodeScale, QrCodeEncoder.QRCodeScale, QrCodeEncoder.QRCodeScale);
if (matrix[j][i])
{
ChangeFillShape(g, Forebrush, rect, EN_FillShape.FillRectangle, new FillShape(), Backbrush);
}
else
ChangeFillShape(g, Backbrush, rect, EN_FillShape.FillRectangle, new FillShape(), Backbrush);
}
}
return image;
}blog:
http://www.cnblogs.com/cheng5x码晒客讨论QQ群:
28629273