PyCDC.DrawText
s,rc,forat = DrawText(s, tuple , format )
Formats text in the given rectangle
Parameters
Example
Example
import win32ui<nl> import win32con<nl> INCH = 1440 # twips - 1440 per inch allows fine res<nl> def drawtext_test():<nl> dc = win32ui.CreateDC()<nl> dc.CreatePrinterDC() # ties to default printer<nl> dc.StartDoc('My Python Document')<nl> dc.StartPage()<nl> <nl> # note: upper left is 0,0 with x increasing to the right,<nl> # and y decreasing (negative) moving down<nl> dc.SetMapMode(win32con.MM_TWIPS)<nl> <nl> # Centers "TEST" about an inch down on page<nl> dc.DrawText('TEST', (0,INCH*-1,INCH*8,INCH*-2), win32con.DT_CENTER )<nl> dc.EndPage()<nl> dc.EndDoc()<nl> del dc<nl>
Return Value
Height of text in pixelsThe return value is the height of the text, in logical units. If DT_VCENTER or DT_BOTTOM is specified, the return value is the offset from rect.top to the bottom of the drawn text. If the function fails, the return value is zero (no Python exception is thrown)