m_MemBitmap.Clear(rect.left,rect.top,rect.right,rect.bottom,RGB(255,255,255));
m_MemBitmap.TextOut(10,10,500,"固定的文本",RGB(0,0,0));
m_MemBitmap.TextOut(x,y,400,"GDI函数实现高速动画演示",RGB(0,255,0));其中Clear是自定义的函数:
void CMemBitmap::Clear(int x1,int y1,int x2,int y2,COLORREF color)
{
CDC* pDC=m_pWnd->GetDC();
CDC dcMem; dcMem.CreateCompatibleDC(pDC);
dcMem.SelectObject(this); CBrush *OldBrush,blbrush(color); dcMem.SetBkMode(TRANSPARENT);
dcMem.SetBkColor(color);
OldBrush=dcMem.SelectObject(&blbrush); dcMem.Rectangle(x1,y1,x2,y2); dcMem.SelectObject(OldBrush);
dcMem.DeleteDC();
m_pWnd->ReleaseDC(pDC);
}可是运行结果却只有两块黑条在白底上,一个是固定的,一个是移动的。
本来按原意,这两块黑条应该是两行有颜色的字啊,为什么会这样?
m_MemBitmap.TextOut(10,10,500,"固定的文本",RGB(0,0,0));
m_MemBitmap.TextOut(x,y,400,"GDI函数实现高速动画演示",RGB(0,255,0));其中Clear是自定义的函数:
void CMemBitmap::Clear(int x1,int y1,int x2,int y2,COLORREF color)
{
CDC* pDC=m_pWnd->GetDC();
CDC dcMem; dcMem.CreateCompatibleDC(pDC);
dcMem.SelectObject(this); CBrush *OldBrush,blbrush(color); dcMem.SetBkMode(TRANSPARENT);
dcMem.SetBkColor(color);
OldBrush=dcMem.SelectObject(&blbrush); dcMem.Rectangle(x1,y1,x2,y2); dcMem.SelectObject(OldBrush);
dcMem.DeleteDC();
m_pWnd->ReleaseDC(pDC);
}可是运行结果却只有两块黑条在白底上,一个是固定的,一个是移动的。
本来按原意,这两块黑条应该是两行有颜色的字啊,为什么会这样?
试过了,不行。