Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing the background of moving image

Status
Not open for further replies.

mayami

Programmer
Aug 30, 2006
4
0
0
PH
I have a moving image and its background have to change at a certain instance. But the result of my codes would retain the previously drawn graph(a region) in which would display overlapping graphs. How can I erase the previous one? Below is the snippet of my codes:

<code>
hdc = ::BeginPaint(m_hWnd, &ps);
//creates new buffer
CreateBackBuffer(BUFFER_GRAPHBG, hdc);
//draw the graph using m_hdcBuff
DrawHighlightGraph(m_hdcBuff[BUFFER_GRAPHBG]);
//m_hdcBuff copied to hdc
::BitBlt(hdc, 0, 0, m_pclsHighlightBmp->GetInfo().bmWidth - HLSLIDER_IMGWIDTH, m_pclsHighlightBmp->GetInfo().bmHeight, m_hdcBuff[BUFFER_GRAPHBG], 0, 0, SRCCOPY);
//drawing of the moving image
DrawNavigatorBar(hdc);
</code>
 
The problem probably isn't your paint. I think it's your invalidate. I suspect that you just calculate and invalidate the rectangle on the fly.

You need a static or global variable with the rectangle where the graph is. Invalidate the old rectangle, recalculate the rectangle, and invalidate that rectangle.

When your background changes, invalidate the entire drawing area, not just the rectangle. Unless you're trying to find out how long it takes for your routine to fill the whole drawing area, of course!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top