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. CMyStatic refresh problem

CMyStatic refresh problem

Scheduled Pinned Locked Moved C / C++ / MFC
graphicshelptutorialquestion
6 Posts 4 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.
  • J Offline
    J Offline
    john5632
    wrote on last edited by
    #1

    I have drived a class from CStatic control. I am using my own method to set text CMyStatic::SetText(). I am drawing text using dc.DrawText(strText,&rectWnd,DT_VCENTER| DT_RIGHT | DT_WORDBREAK); in paint method but If I want to set another string It is getting overlapped. So I am not able to see the extact string. How to solve this refreshing problem?

    N S 2 Replies Last reply
    0
    • J john5632

      I have drived a class from CStatic control. I am using my own method to set text CMyStatic::SetText(). I am drawing text using dc.DrawText(strText,&rectWnd,DT_VCENTER| DT_RIGHT | DT_WORDBREAK); in paint method but If I want to set another string It is getting overlapped. So I am not able to see the extact string. How to solve this refreshing problem?

      N Offline
      N Offline
      Niklas L
      wrote on last edited by
      #2

      From where do you get the strText? The problem might be because the underlying CStatic controls window text is set (and drawn). In your SetText(), you might have to clear this by calling SetWindowText(_T("")). Depending on what you mean by overlapping, another reason could be that your rectangle isn't large enough to fit the text, in which case you can use the flag DT_CALCRECT to get the size needed.

      home

      J 1 Reply Last reply
      0
      • N Niklas L

        From where do you get the strText? The problem might be because the underlying CStatic controls window text is set (and drawn). In your SetText(), you might have to clear this by calling SetWindowText(_T("")). Depending on what you mean by overlapping, another reason could be that your rectangle isn't large enough to fit the text, in which case you can use the flag DT_CALCRECT to get the size needed.

        home

        J Offline
        J Offline
        john5632
        wrote on last edited by
        #3

        I am passing text from outside using SetText function. This static control is drawn over a custome dialog which is having some color, If I use SetWindowText(_T()) I am getting window native color. Overlapping means , One test is drawn on anothet text. I am giving enough size to draw.

        E N 2 Replies Last reply
        0
        • J john5632

          I am passing text from outside using SetText function. This static control is drawn over a custome dialog which is having some color, If I use SetWindowText(_T()) I am getting window native color. Overlapping means , One test is drawn on anothet text. I am giving enough size to draw.

          E Offline
          E Offline
          Electron Shepherd
          wrote on last edited by
          #4

          Setting the background mode of the DC to OPAQUE may help. See http://msdn.microsoft.com/en-US/library/a3w1xce7.aspx[^]

          Server and Network Monitoring

          1 Reply Last reply
          0
          • J john5632

            I have drived a class from CStatic control. I am using my own method to set text CMyStatic::SetText(). I am drawing text using dc.DrawText(strText,&rectWnd,DT_VCENTER| DT_RIGHT | DT_WORDBREAK); in paint method but If I want to set another string It is getting overlapped. So I am not able to see the extact string. How to solve this refreshing problem?

            S Offline
            S Offline
            S p k 521
            wrote on last edited by
            #5

            call UpdateData(FALSE);

            1 Reply Last reply
            0
            • J john5632

              I am passing text from outside using SetText function. This static control is drawn over a custome dialog which is having some color, If I use SetWindowText(_T()) I am getting window native color. Overlapping means , One test is drawn on anothet text. I am giving enough size to draw.

              N Offline
              N Offline
              Niklas L
              wrote on last edited by
              #6

              Are you erasing the background properly when your control is refreshed?

              home

              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