DrawText VS TextOut Win32

devjeetroy picture devjeetroy · Nov 11, 2011 · Viewed 19k times · Source

I find have used both these functions before, but I don't quite see the the difference between them. Well, I know that DrawText requires a formatting rectangle,and can do some text formatting, and textout only the starting coordinates, are there any other differences?

Answer

cpx picture cpx · Nov 11, 2011

DrawText

  • It draws a text string into a rectangle region specified in logical coordinates.
  • It provides convenient ways of formatting multiline text.
  • It is mainly used for wordbreaking paragraph formatting, expanding tabs etc.

TextOut

  • It is a simple text-drawing function which is easy to use.
  • It draws a character string at a specified location, using the currently selected text attributes.
  • The text string to draw does not need to be zero terminated.

Also, take a look at ExTextOut and DrawTextEx