Re: screen keeps splashing all the time-- Urgent
We had this same conversation last week in this forum so you may want to
peruse the threads for more information, but this might help you get started
(I assume by "splashing" you mean flickering.
http://www.codeproject.com/gdi/flickerfree.asp
Tom
"Joseph Anderson" <josndrsn@yahoo.com> wrote in message
news:up3bKUgaHHA.4508@TK2MSFTNGP03.phx.gbl...
Dear all,
I have code like the following lines, but when I try to run the
program, I find when the values of m_uCurrentScale grows , the screen
keeps splashing all the time, could anybody give me a good solution!
HRESULT OnDraw(ATL_DRAWINFO& di)
{
CRect rc = *(RECT*)di.prcBounds;
Rectangle(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom);
//Draw progress bar
CBrush brBackground(RGB(0, 0, 0xFF));
CRect rect = CRect(0, 0, 0, 0);
if (m_uFullScale > 0)
{
rect.left = 0;
rect.top = 0;
rect.right = (int)(rc.Width() * (m_uCurrentScale * 1.0 /
m_uFullScale));
rect.bottom = rc.Height();
TRACE("%d, %d, %d, %d\n", rect.left, rect.top, rect.right,
rect.bottom);
FillRect(di.hdcDraw, &rect, brBackground);
//Write progress text
SetBkMode(di.hdcDraw, TRANSPARENT); //
CString strScale;
strScale.Format(_T("%u%%"), 100 * m_uCurrentScale / m_uFullScale);
DrawText(di.hdcDraw, strScale, strScale.GetLength(), &rc, DT_CENTER |
DT_VCENTER);
}
TRACE("OnDraw\n");
return S_OK;
}
Any helpful ideas would be appreciated!
-Joseph