您的位置:首页 > 编程语言 > C#

C# 用GDI在图片上写字实现lable透明背景

2013-03-22 11:42 288 查看
Bitmap bmp = new Bitmap(pictureBox1.Image);//加载位图 pictureBox1.Image

Graphics g = Graphics.FromImage(bmp);

Font font = new Font("Tahoma", 25, FontStyle.Bold);//设置字体

SolidBrush sbrush = new SolidBrush(Color.White);//字体颜色

g.DrawString(globaldata.relative_height, font, sbrush, 430, 301);//在相应位置写字globaldata.relative_height

g.DrawString(globaldata.angle, font, sbrush, 455, 349);//在相应位置写字globaldata.angle

MemoryStream ms = new MemoryStream();

bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);//将位图保存

pictureBox1.Image = bmp;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: