如何使用C#向图像添加多行文字 [英] How do I add multiline text to an image using C#

查看:97
本文介绍了如何使用C#向图像添加多行文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



在我的应用程序中,用户上传图像并输入文本推荐。

文本的长度可以是10个字到500个字之间的任何地方。



我必须生成一个新图像,文本覆盖在原始图像上。



我知道如何向图像添加文字,但这一切都在一条直线上。在这里,当文本到达图像右边界时,我希望文本中断并移动到下一行。文本将从图像的左上角开始。



请建议解决方案。

Hi All

In my application the user uploads an image and also enter a text testimonial.
The length of text can be anywhere between 10 words to 500 words.

I have to generate a new image having text overlayed on the original image.

I know how to add text to image but that is all in a straight line. Here i want text to break and move on to next line when it reaches the image right border. The text would start at top left corner of the image.

Please suggest a solution.

推荐答案

我只能想象你在文本绘图中使用了什么(没有代码),但是绘制多行文本的选项是使用DrawString的右重载(带有矩形的选项而不是点)...

https://msdn.microsoft.com/en-us/ library / baw6k39s(v = vs.110).aspx [ ^ ]
I only can imagine what do you use for text-drawing (no code), but on option to draw multiline text is using the right overload of DrawString (the one with rectangle as option instead of poin)...
https://msdn.microsoft.com/en-us/library/baw6k39s(v=vs.110).aspx[^]


这篇关于如何使用C#向图像添加多行文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆