I have a label with fixed length and word wrap property set to true. At run time that label has two lines e.g.:
test := 'quick brown fox jumps over the lazy dog';
On Label this text displayed as two lines
quick brown fox jumps
over the lazy dog
I want to know number of lines at run time:
#13#10 does not work.
The DrawText function can be used for this purpose.
The rest of the procedure doesn't differ so much from what David Heffernan proposes in his comment.
The key here is to adopt the flags
DT_WORDBREAKto automatically break the lines and theDT_EDITCONTROLto mimic the caption's text behaviour.