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>
<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>