Determine bounding rect of a string [modified]
-
Hey, I've a string including multiple lines. Now I want to use the DrawText DT_CALC feature to calc the height of the bounding rectangle, but leave the right side as it is. The returning rect has always a extended right side. How can I solve this problem? Thank you...
CRect reRect(0,0,150,0); CString szText("Hallo\ndies ist ein Test\nHello\nthis is a test"); pDC->DrawText(szText,&reRect, DT_CALCRECT);
-- modified at 9:12 Wednesday 28th June, 2006 -
Hey, I've a string including multiple lines. Now I want to use the DrawText DT_CALC feature to calc the height of the bounding rectangle, but leave the right side as it is. The returning rect has always a extended right side. How can I solve this problem? Thank you...
CRect reRect(0,0,150,0); CString szText("Hallo\ndies ist ein Test\nHello\nthis is a test"); pDC->DrawText(szText,&reRect, DT_CALCRECT);
-- modified at 9:12 Wednesday 28th June, 2006I don't what you are trying to do but does GetTextExtent[^] help ?
Cédric Moonen Software developer
Charting control -
Hey, I've a string including multiple lines. Now I want to use the DrawText DT_CALC feature to calc the height of the bounding rectangle, but leave the right side as it is. The returning rect has always a extended right side. How can I solve this problem? Thank you...
CRect reRect(0,0,150,0); CString szText("Hallo\ndies ist ein Test\nHello\nthis is a test"); pDC->DrawText(szText,&reRect, DT_CALCRECT);
-- modified at 9:12 Wednesday 28th June, 2006 -
Hey, I've a string including multiple lines. Now I want to use the DrawText DT_CALC feature to calc the height of the bounding rectangle, but leave the right side as it is. The returning rect has always a extended right side. How can I solve this problem? Thank you...
CRect reRect(0,0,150,0); CString szText("Hallo\ndies ist ein Test\nHello\nthis is a test"); pDC->DrawText(szText,&reRect, DT_CALCRECT);
-- modified at 9:12 Wednesday 28th June, 2006try using
\r\n
instead of\n
only inszText