By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,939 Members | 1,547 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,939 IT Pros & Developers. It's quick & easy.

can't force redraw of my frame

P: n/a
Hi!
I want to show a blinking text over my derived CMDIChildWnd-class. The
blinking is done by one view which is hold by my frame. I set up a timer and
write text to the parent frame, which works fine. But I can't get the text
away the next time the timer fires. Here is some code:

void MyView::OnTimer(UINT nIDEvent)
{
if (nIDEvent!=1) return;
showText = !showText;
// Call base class handler.
CView::OnTimer(nIDEvent);

CUserFrame* frame = (CUserFrame*)(this->GetParentFrame());
CRect clientRect;
frame->GetClientRect(&clientRect);

if (showText){
// display the text --------- THIS WORKS FINE
CFont font;
CDC* dc = frame->GetDC();
font.CreatePointFont (720, _T ("Arial"));
CFont* oldFond = dc->SelectObject (&font);;
dc->SetBkMode (TRANSPARENT);
dc->SetTextColor(RGB(255,100,0));
dc->DrawText(_T("blink"), clientRect, DT_SINGLELINE | DT_CENTER |
DT_VCENTER);
dc->SelectObject (oldFond);
frame->ReleaseDC(dc);
}else{
// remove the text -------------- DOESN'T WORK

// here are many things I tried, but without success
::InvalidateRect(frame->m_hWnd,0,TRUE);
::InvalidateRect(frame->m_hWnd,&clientRect,TRUE);
::UpdateWindow(frame->m_hWnd);
frame->UnlockWindowUpdate();
frame->Invalidate(true);
frame->UpdateWindow();
frame->RedrawWindow();
frame->my2View->UnlockWindowUpdate(); /* my2View is anoter
view that the frame holds (It has a static splitter)*/
frame->my2View->InvalidateRect(&clientRect);
frame->my2View->Invalidate(true);
frame->my2View->UpdateWindow();
frame->my2View->RedrawWindow();
AfxGetMainWnd()->RedrawWindow();

/* To be sure that the code is working corect I added a drawText
here,
which is displayed correctly above the first text and is under
the "blink" after the next timer event */
CDC* dc = frame->GetDC();
dc->DrawText(_T("hello..."), clientRect, DT_SINGLELINE | DT_CENTER |
DT_VCENTER);
frame->ReleaseDC(dc);
}
}

So the result of the above code is that "blink" is written on my window,
then "hello" is written above it, than "blink" again... but the other text
will never be deleted.
Anyone any ideas why this is so, why the window is not redrawn, so the
"blink" should disapear, becaus it is not in the frames OnPaint()?

Thanks for any help
Maik
Jul 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Maik Wiege" <mi*****@gmx.de> wrote in message
news:bu*************@news.t-online.com...
Hi!
I want to show a blinking text over my derived CMDIChildWnd-class. The blinking is done by one view which is hold by my frame. I set up a timer and write text to the parent frame, which works fine. But I can't get the text away the next time the timer fires. Here is some code:


This is a very advanced subject. We cannot help you here. You should
post in a newsgroup devoted to blinking text.

Jonathan
Jul 22 '05 #2

P: n/a
Jonathan Turkanis wrote:
"Maik Wiege" <mi*****@gmx.de> wrote in message
news:bu*************@news.t-online.com...
Hi!
I want to show a blinking text over my derived CMDIChildWnd-class.
The
blinking is done by one view which is hold by my frame. I set up a


timer and
write text to the parent frame, which works fine. But I can't get


the text
away the next time the timer fires. Here is some code:

This is a very advanced subject. We cannot help you here. You should
post in a newsgroup devoted to blinking text.


Actually, we can't help you here because it is and MFC question.
Go to a VisualC newsgroup.

:)

Jorge L.

Jonathan

Jul 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.