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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -