TextRenderer.DrawText vs Graphics.DrawString

G

Guest

Hello all,
I have a WYSIWYG editor which uses Graphics.DrawString to render it's
text. The Font size is scaled based on the sized of the form and everything
looks the same, no matter how you resize the form (i.e consitent word
wrapping).

I tried switching to TextRenderer.DrawText and cannot get consistent results
: when resizing the form, word wrapping is inconsistent : sometimes a word is
at the end of a line and sometimes the word wrap to the next line.

I used the TextFormatFlagsUtil (see MSDN Mag, March 2006) to match the flags
I'm using with DrawString --> DrawText.

Any idea / reason why I can't have consistent results ??

thank you
 
D

Dave Sexton

Hi plumeprog,

Well, TextRenderer uses GDI while Graphics.DrawString uses GDI+ to render strings. Unfortunately I don't know the exact reason for
the behavior you have witnessed so I assume it is this fundamental difference between the tools that is causing inconsistent text
wrapping.

AFAIK it doesn't really matter which method you choose, so choose the one that works for you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top