void CDRImageStatic::ShowImg(CDC *dc, CRect rect) { CBitmap bmp; bmp.CreateCompatibleBitmap(dc, m_nWidth, m_nHeight); CBitmap* pOld=NULL; CDC memDC; memDC.CreateCompatibleDC( dc ); if (m_nColor!=NULL) { EnterCriticalSection(&csImgCriticalSection); bmp.SetBitmapBits(sizeof(*m_nColor)*m_nHeight*m_nWidth, m_nColor); LeaveCriticalSection(&csImgCriticalSection); pOld = memDC.SelectObject( &bmp ); } if((m_nDXA==0)) { EnterCriticalSection(&csMyCriticalSection); int oldmode=memDC.SetBkMode(TRANSPARENT); CPen * pOldPen=memDC.SelectObject(&m_Pen); memDC.MoveTo(rect.right-m_nCurPosX,0); memDC.LineTo(rect.right-m_nCurPosX,rect.bottom); memDC.SelectObject(pOldPen); memDC.SetBkMode(oldmode); BOOL bbR=m_nCurPosX!=m_nOldPosX; if (!this->m_blCreateLine || bbR) { this->m_blCreateLine=TRUE; m_nOldPosX=m_nCurPosX; InvalidateRect(rect,FALSE); } memDC.MoveTo(CPoint(0,0)); LeaveCriticalSection(&csMyCriticalSection); } dc->BitBlt( rect.left, rect.top, rect.Width(), rect.Height(), &memDC, 0, 0, SRCCOPY ); if (pOld!=NULL) { memDC.SelectObject(pOld); } memDC.DeleteDC(); bmp.DeleteObject(); }