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. .DrawText makes my app laggy/sluggish (MFC C++)

.DrawText makes my app laggy/sluggish (MFC C++)

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
5 Posts 3 Posters 1 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.
  • K Offline
    K Offline
    karhong
    wrote on last edited by
    #1

    Hi, I've search throughout the net, cant find any solution. Hope someone able to help me. My apps had a panel which can draw many rect. The app can be moved by draggin left/right using mouse. Whenever i moved the panel, it'll try to move all the rectangle to top/bottom/left/right following the mouse motion. When the mouse move, it will force the rectangle to be redraw. My app become laggy whenever i use .DrawText to a multiple line of text inside the rectangle. I have around 80++ rect which used .DrawText to display the text on each rect. I've tested, if the text is only 1 short words without /r/n (one line), then it will display nicely without laggy. eg: Alice But if the text is in multiline (about 4~5 lines) i tried to run .DrawText, it makes my apps lagg. eg: Alice in wonderland Any idea ?? The command i used : dc.DrawText(strDraw, rcText, DT_LEFT | DT_WORD_ELLIPSIS); Regards, KH

    good

    CPalliniC K 2 Replies Last reply
    0
    • K karhong

      Hi, I've search throughout the net, cant find any solution. Hope someone able to help me. My apps had a panel which can draw many rect. The app can be moved by draggin left/right using mouse. Whenever i moved the panel, it'll try to move all the rectangle to top/bottom/left/right following the mouse motion. When the mouse move, it will force the rectangle to be redraw. My app become laggy whenever i use .DrawText to a multiple line of text inside the rectangle. I have around 80++ rect which used .DrawText to display the text on each rect. I've tested, if the text is only 1 short words without /r/n (one line), then it will display nicely without laggy. eg: Alice But if the text is in multiline (about 4~5 lines) i tried to run .DrawText, it makes my apps lagg. eg: Alice in wonderland Any idea ?? The command i used : dc.DrawText(strDraw, rcText, DT_LEFT | DT_WORD_ELLIPSIS); Regards, KH

      good

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      Cannot believe DrawText makes your system lag. Please post the relevant code. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      In testa che avete, signor di Ceprano?

      K 1 Reply Last reply
      0
      • CPalliniC CPallini

        Cannot believe DrawText makes your system lag. Please post the relevant code. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        K Offline
        K Offline
        karhong
        wrote on last edited by
        #3

        oh.. it makes the apps lag only.. the system doesnt lag

        good

        CPalliniC 1 Reply Last reply
        0
        • K karhong

          oh.. it makes the apps lag only.. the system doesnt lag

          good

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #4

          OK. And what about the 'relevant code'? :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          In testa che avete, signor di Ceprano?

          1 Reply Last reply
          0
          • K karhong

            Hi, I've search throughout the net, cant find any solution. Hope someone able to help me. My apps had a panel which can draw many rect. The app can be moved by draggin left/right using mouse. Whenever i moved the panel, it'll try to move all the rectangle to top/bottom/left/right following the mouse motion. When the mouse move, it will force the rectangle to be redraw. My app become laggy whenever i use .DrawText to a multiple line of text inside the rectangle. I have around 80++ rect which used .DrawText to display the text on each rect. I've tested, if the text is only 1 short words without /r/n (one line), then it will display nicely without laggy. eg: Alice But if the text is in multiline (about 4~5 lines) i tried to run .DrawText, it makes my apps lagg. eg: Alice in wonderland Any idea ?? The command i used : dc.DrawText(strDraw, rcText, DT_LEFT | DT_WORD_ELLIPSIS); Regards, KH

            good

            K Offline
            K Offline
            KarstenK
            wrote on last edited by
            #5

            such drawing problems can be solved via drawing in a memory bitmap and only blitting it to screen. That articles is a great example HOW TO do it: Link: CEnBitmap

            Press F1 for help or google it. Greetings from Germany

            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