CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Feb 2008
    Posts
    138

    [RESOLVED] DrawText in AnimateWindow.

    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.

    Code:
    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;
    }
    Last edited by techie.ashish; October 16th, 2008 at 06:26 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured