DrawText in animatewindow. [modified]
-
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
-
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
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[^]
-
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[^]
It might be silly question.. But where to put Redraw??
-
It might be silly question.. But where to put Redraw??
I suggest at the end of the block, after DrawText.
-
I suggest at the end of the block, after DrawText.
Thanks.. But it's not working.. Tried different Flags also.. Does DrawText ever works with AnimateWindow or Moving Dialog??
-
Thanks.. But it's not working.. Tried different Flags also.. Does DrawText ever works with AnimateWindow or Moving Dialog??
I think its better you use of WM_TIMER for DrawText .
-
I think its better you use of WM_TIMER for DrawText .
I agree, WM_TIMER will work fine