Sock_str = " 10060*Connection timed out" Sock_str = " 10051*Network is unreachable" Sock_str = " 10049*Cannot assign requested address" Sock_str = " 10048*Address already in use" (the text is "This is somewhat longer" and there's space for 3 lines) This works reasonably well but not well enough because it produces things like this: After this, i used DrawText again with DT_WORDBREAK to display the string. Then i iterated trough the words and checked the widths of the words and if they were too wide then i'd find the character inside the word which would hang out of the rectange and inserted a space. there are a few long words) then i'd like the text to e.g wrap around at positions where the long words would "hang out" of the rectangle.įirst i tried DT_CALCRECT with DrawText to check if the text fits, if yes then i simply draw it with DrawText and go on, if not, then i tokenized the string using space as separator/delimiter. However, when the specified rectangle is too small, the text doesn't fit into it even with wordbreaks (e.g. What i mean is, if the text fits nicely in the rectangle, it should be displayed as usual, centered with wordbreaks as needed (DrawText with DT_WORDBREAK | DT_CENTER). I want to display as much as possible of this text. Am looking for a way to do this: i have a rectangle that specifies the available space for some text.
0 Comments
Leave a Reply. |