C#在位图上写文本

我有以下问题。我想在C#Windows窗体中制作一些图形。我想将位图读取到程序中,然后在该位图上写一些文本。最后,我希望将此图片加载到pictureBox。这是我的问题。我该怎么做?


例如,它如何工作:


Bitmap a = new Bitmap(@"path\picture.bmp");

a.makeTransparent();

// ? a.writeText("some text", positionX, positionY);

pictuteBox1.Image = a;

有可能吗?


慕神8447489
浏览 384回答 3
3回答

拉风的咖菲猫

您需要使用Graphics该类才能在位图上进行编写。具体来说,DrawString方法之一。Bitmap a = new Bitmap(@"path\picture.bmp");using(Graphics g = Graphics.FromImage(a)){  g.DrawString(....); // requires font, brush etc}pictuteBox1.Image = a;
打开App,查看更多内容
随时随地看视频慕课网APP