hi,all, problems about drawtext.
-
hi,all. I have a string to draw, I only know the position the string textout and extention in horizon the string is bounded to, so I want to calculate its bounding box's height, I do it as this: CRect rtBBox; int iWidth = XXXXXXX; //Supose we know its value CPoint ptPos = XXXXXX; //supose we know its value,too rt.SetRect(ptPos.x,ptPos.y,ptPos.x + iWidth,ptPos); pDC->DrawText(strText,rt,DT_EDITCONTROL|DT_WORDBREAK|DT_CALCRECT); //rt: out from drawtext coz I set one flat DT_CALCRECT pDC->DrawText(strText,rt,DT_EDITCONTROL|DT_WORDBREAK); when the strText is not so many characters, then it works fine, but when character is too many, then its too slow. now the question is: how can I draw text like I do it in multiline edit control with good efficiency. thanks, regards. life is like a box of chocolate, you never know what you r going to get
-
hi,all. I have a string to draw, I only know the position the string textout and extention in horizon the string is bounded to, so I want to calculate its bounding box's height, I do it as this: CRect rtBBox; int iWidth = XXXXXXX; //Supose we know its value CPoint ptPos = XXXXXX; //supose we know its value,too rt.SetRect(ptPos.x,ptPos.y,ptPos.x + iWidth,ptPos); pDC->DrawText(strText,rt,DT_EDITCONTROL|DT_WORDBREAK|DT_CALCRECT); //rt: out from drawtext coz I set one flat DT_CALCRECT pDC->DrawText(strText,rt,DT_EDITCONTROL|DT_WORDBREAK); when the strText is not so many characters, then it works fine, but when character is too many, then its too slow. now the question is: how can I draw text like I do it in multiline edit control with good efficiency. thanks, regards. life is like a box of chocolate, you never know what you r going to get
I checked it, no matter what flag you set for drawtext, once the string is long enough, then the speed will be slow,and it happens obviously. life is like a box of chocolate,you never know what you r going to get.