开发者

How to draw string on an image to be assigned as the background to a control in Winforms?

开发者 https://www.devze.com 2022-12-09 15:28 出处:网络
The string length can change, height is the same. The font is large for visibility. But how do I do thi开发者_如何学Gos?

The string length can change, height is the same. The font is large for visibility.

But how do I do thi开发者_如何学Gos?

I know painting on the control directly. But how do I do this without creating an image file, but all in memory. Because the string image will change with user interaction.


Something like ...

Image i = new Bitmap(200, 50);
Graphics g = Graphics.FromImage(i);
g.DrawString("Message", new Font("Arial", 8), Brushes.Black, new PointF(0,0));

pictureBox.Image = i;
g.Dispose();
0

精彩评论

暂无评论...
验证码 换一张
取 消