Trying to terminate the text drawn by drawText(Win32) if there is not enough height in the rect

StackOverflow https://stackoverflow.com/questions/10348344

문제

I am trying to draw a multiline text using drawText. I am able to keep the width constant by passing DT_WORD_ELLIPSIS | DT_WORDBREAK flags but if the string is long the text is getting cut vertically in the last line.

How to ensure that drawText doesn't draw the last line if it it can't fit the whole height ?

Currently I am passing these flags to drawText - DT_NOPREFIX | DT_WORD_ELLIPSIS | DT_LEFT | DT_WORDBREAK | DT_EXTERNALLEADING

도움이 되었습니까?

해결책

Specify the DT_EDITCONTROL flag. According to the MSDN documentation:

DT_EDITCONTROL

Duplicates the text-displaying characteristics of a multiline edit control. Specifically, the average character width is calculated in the same manner as for an edit control, and the function does not display a partially visible last line.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top