c# 透明png 写入文字

string fileame = "c:/test.png";
//图片文字
string str = DateTime.Now.ToString("yyMMddHHmmss");

Bitmap image = new Bitmap(600, 400);
Graphics g = Graphics.FromImage(image);

//填充透明色
g.Clear(Color.Transparent);

//写文字
g.DrawString(str, new Font("宋体", 28), new SolidBrush(Color.Red), 40, 10);

//Graphics 类还有很多绘图方法可以绘制 直线、曲线、圆等等
image.Save(fileame , System.Drawing.Imaging.ImageFormat.Png);

posted @ 2024-03-10 12:11  過朢  阅读(69)  评论(0)    收藏  举报