-
August 18th, 2004, 10:23 AM
#1
DrawText word wrap
Hi,
I'm looking for the formatting option parameters necessary in DrawText or DrawTextEx to wrap a long filename properly.
My static control that Im drawing the text in is large enough...but there are rarely spaces in the filename, so the only alternative Ive managed is ellipses. Id prefer the text to go to the next line.
DT_WORDBREAK only breaks lines between words.
Thx.
-
August 18th, 2004, 03:56 PM
#2
I'm looking at the DirectX SDK for the documentation of ID3DXFont:rawText (which is just a wrapper for GDI's DrawText). I had this very issue with the ID3DXFont variant of this function.
What did I do to remedy it? I calculated when my string would be extending past the edge of the rect and inserted the newline character in the place of the first character that would break the edge of the rect.
Worked like a charm for me.
Edit: Whoops. Just remembered something:
To keep it left-justified I also checked to see if the next character after my inserted newline character was a space and removed it. (Just incase you actually break on a word).
Last edited by Darnit; August 18th, 2004 at 04:01 PM.
-
December 28th, 2017, 10:13 PM
#3
Re: DrawText word wrap
just use DT_WORDBREAK|DT_EDITCONTROL in DrowText format
-
December 29th, 2017, 03:07 AM
#4
Re: DrawText word wrap
Originally Posted by basharbm
just use DT_WORDBREAK|DT_EDITCONTROL in DrowText format
Very "actual" answer for the more than 13 years old thread!
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|