delphi - How do I use DrawText DT_CALCRECT properly? -
i generating report has caption in footer. use drawtext find out caption's dimensions. problem text clipped, when have carriage return @ end of text, text appears perfectly.
lclientrect := rect(0, 0, 4770, 59); lflags := dt_calcrect or dt_expandtabs or alignments[alignment] or wordwraps[wordwrap] or dt_noprefix or dt_top or dt_externalleading; drawtext(lcanvas.handle, pchar(lscaption), length(lscaption), lclientrect, lflags);
i examined rect after call drawtext, , (0, 0, 4366, 59), when have carriage return, (0, 0, 4366, 118).
i don't have clue on happening. appreciated.
the carriage return adds second line of text string, doubling height of calculated rectangle. (windows flexible whether line-feed or carriage-return character starts new line.)
as why text clipped (on bottom edge, assume), might you're calculating size using different font have when draw text.
Comments
Post a Comment