Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. hi,all, problems about drawtext.

hi,all, problems about drawtext.

Scheduled Pinned Locked Moved C / C++ / MFC
question
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    William Wang
    wrote on last edited by
    #1

    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

    W 1 Reply Last reply
    0
    • W William Wang

      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

      W Offline
      W Offline
      William Wang
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups