开发者

DrawString to Rectangle, how to manually jump to new line?

When you DrawString to a Re开发者_StackOverflow中文版ctangle it wraps the text nicely within those bounds.

What I want however is to be able to jump to the next line within those bounds at will. So I could write: This

is the content of a larger rectangle.

An alternative would be to just use multiple DrawStrings (representing one line each, from a split string or similar) but I'm looking for a simpler more elegant way if possible.


You can simply put a newline (\r\n) in the string.


EDIT: D'Oh, looks like you have got it answered while I was typing this up and looking through my code about NoWrap flags =) Glad to see you figured it out.


Like SLaks stated you can force a newline in your text. It should just work if your text is already wrapping naturally.

I cannot recall having to anything special other than making sure NoWrap was not in the FormatFlags. This should not apply to you since it is already wrapping.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜