C#Qrcode生成二维码支持带标题
2021-03-04 03:25
标签:main param new height 字符串 encode ant guid directory 过程不在叙述, C#Qrcode生成二维码支持带标题 标签:main param new height 字符串 encode ant guid directory 原文地址:https://www.cnblogs.com/gskstudy/p/12952456.html
///
public static Bitmap KiSetText(Bitmap b, string txt, int x, int y)
{
if (b == null)
{
return null;
}
Bitmap resizeImage = new Bitmap(b.Width, b.Height + 40);
Graphics gfx = Graphics.FromImage(resizeImage);
gfx.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
gfx.FillRectangle(Brushes.White, new Rectangle(0, 0, 400, 100));
gfx.DrawImageUnscaled(b, 0, 40);
// 作为演示,我们用Arial字体,大小为32,红色。
FontFamily fm = new FontFamily("Arial");
Font font = new Font(fm, 24, FontStyle.Regular, GraphicsUnit.Pixel);
SolidBrush sb = new SolidBrush(Color.Black);
gfx.DrawString(txt, font, sb, new PointF(x, y));
gfx.Dispose();
return resizeImage;
}
下一篇:Web APIs
文章标题:C#Qrcode生成二维码支持带标题
文章链接:http://soscw.com/index.php/essay/59800.html