Is there a way to programmatically add text to a System.Drawing.Image?

前端 未结 2 1800
借酒劲吻你
借酒劲吻你 2021-01-22 04:19

I have a System.Drawing.Image that I display with System.Drawing.Graphics DrawImage function. The image is a police car, and I would like to draw a unit number on top of the p

2条回答
  •  天涯浪人
    2021-01-22 04:57

    It's not clear if you are trying to add the text to the image or just display text on the image:

    To the image:

    using (Graphics g = Graphics.FromImage(yourImage))
    {
      g.DrawString(...);
    }
    

    or On the image:

    e.Graphics.DrawImage(...);
    e.Graphics.DrawString(...);
    

提交回复
热议问题