True height of wrapped text in a CStatic
I have created a CStatic with a size specified by a CRect.
The text that I have added to the CStatic (using SetWindowText) is long enough that it wraps inside the CStatic control.
I have a window full of these CStatic controls and I want to be able to resize the height of each of the CStatic controls that contain wrapped text so that all the text can be seen. Then I have to move all the CStatic controls so that none of them overlap.
I have been unable to figure out a way to determine if a CStatic has wrapped text in it, or how to determine the height the CStatic would have to be to display all the text. Is there a way?
I've tried to use GetOutputTextExtent() (and then divide by the length of the control in logical units), but it doesn't quite work because GetOutputTextExtent returns the length of the text assuming everything is on one line and doesn't take into account the blank space that occurs at the end of each line due to the text being unjustified.
Thanks...