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 in animatewindow. [modified]

DrawText in animatewindow. [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
graphicshelpquestion
7 Posts 3 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.
  • G Offline
    G Offline
    gothic_coder
    wrote on last edited by
    #1

    Hi all.. How do i use DrawText in animate window. With the help of animate window i'm popping up my dialog box. And in WM_PAINT i'm using DrawText to put some text on Bitmap. DrawText works fine when i don't use animatewindow. But it didn't work when using animatewindow.

    case WM_PAINT:
    {
    PAINTSTRUCT ps;
    HDC hDC;
    hDC = BeginPaint(hWnd, &ps);

       RECT r = {0};
    HDC hdc\_bitmap\_text = NULL;
    UpdateWindow(hWnd);
    GetClientRect(GetDlgItem(hWnd, IDC\_NEW\_BITMAP), &r);
    hdc\_bitmap\_text = GetDC(GetDlgItem(hWnd, IDC\_NEW\_BITMAP));
    
    if(hdc\_bitmap\_text)
    {
    	SetBkMode(hdc\_bitmap\_text, TRANSPARENT);
    	SetTextColor(hdc\_bitmap\_text, RGB(0,0,0)); 
    
        	DrawText(hdc\_bitmap\_text,
    			iCm->BitmapMessage,
    			-1, 
    			&r, 
    			DT\_SINGLELINE | DT\_CENTER | DT\_VCENTER);
    			
    	ReleaseDC(GetDlgItem(hWnd, IDC\_NEW\_BITMAP), hdc\_bitmap\_text);
    	hdc\_bitmap\_text = NULL;
    }
      EndPaint(hWnd, &ps);
    

    break;
    }

    modified on Thursday, October 16, 2008 7:25 AM

    J 1 Reply Last reply
    0
    • G gothic_coder

      Hi all.. How do i use DrawText in animate window. With the help of animate window i'm popping up my dialog box. And in WM_PAINT i'm using DrawText to put some text on Bitmap. DrawText works fine when i don't use animatewindow. But it didn't work when using animatewindow.

      case WM_PAINT:
      {
      PAINTSTRUCT ps;
      HDC hDC;
      hDC = BeginPaint(hWnd, &ps);

         RECT r = {0};
      HDC hdc\_bitmap\_text = NULL;
      UpdateWindow(hWnd);
      GetClientRect(GetDlgItem(hWnd, IDC\_NEW\_BITMAP), &r);
      hdc\_bitmap\_text = GetDC(GetDlgItem(hWnd, IDC\_NEW\_BITMAP));
      
      if(hdc\_bitmap\_text)
      {
      	SetBkMode(hdc\_bitmap\_text, TRANSPARENT);
      	SetTextColor(hdc\_bitmap\_text, RGB(0,0,0)); 
      
          	DrawText(hdc\_bitmap\_text,
      			iCm->BitmapMessage,
      			-1, 
      			&r, 
      			DT\_SINGLELINE | DT\_CENTER | DT\_VCENTER);
      			
      	ReleaseDC(GetDlgItem(hWnd, IDC\_NEW\_BITMAP), hdc\_bitmap\_text);
      	hdc\_bitmap\_text = NULL;
      }
        EndPaint(hWnd, &ps);
      

      break;
      }

      modified on Thursday, October 16, 2008 7:25 AM

      J Offline
      J Offline
      Jose David Pujo
      wrote on last edited by
      #2

      try

      RedrawWindow (hWnd, 0,0,RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);

      Maybe parameters should be diferent: Link: http://msdn.microsoft.com/en-us/library/ms534900(VS.85).aspx[^]

      G 1 Reply Last reply
      0
      • J Jose David Pujo

        try

        RedrawWindow (hWnd, 0,0,RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);

        Maybe parameters should be diferent: Link: http://msdn.microsoft.com/en-us/library/ms534900(VS.85).aspx[^]

        G Offline
        G Offline
        gothic_coder
        wrote on last edited by
        #3

        It might be silly question.. But where to put Redraw??

        J 1 Reply Last reply
        0
        • G gothic_coder

          It might be silly question.. But where to put Redraw??

          J Offline
          J Offline
          Jose David Pujo
          wrote on last edited by
          #4

          I suggest at the end of the block, after DrawText.

          G 1 Reply Last reply
          0
          • J Jose David Pujo

            I suggest at the end of the block, after DrawText.

            G Offline
            G Offline
            gothic_coder
            wrote on last edited by
            #5

            Thanks.. But it's not working.. Tried different Flags also.. Does DrawText ever works with AnimateWindow or Moving Dialog??

            H 1 Reply Last reply
            0
            • G gothic_coder

              Thanks.. But it's not working.. Tried different Flags also.. Does DrawText ever works with AnimateWindow or Moving Dialog??

              H Offline
              H Offline
              Hamid Taebi
              wrote on last edited by
              #6

              I think its better you use of WM_TIMER for DrawText .

              J 1 Reply Last reply
              0
              • H Hamid Taebi

                I think its better you use of WM_TIMER for DrawText .

                J Offline
                J Offline
                Jose David Pujo
                wrote on last edited by
                #7

                I agree, WM_TIMER will work fine

                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