MemDC :cdc
init()函數
{this->GetClientRect(&rect);
MemDC.CreateCompatibleDC(NULL);
//MemDC.FillSolidRect(&rect, 0x00FFFFFF);
memBitmap.CreateCompatibleBitmap(&MemDC,rect.right,rect.bottom);
::SelectObject(MemDC.GetSafeHdc(), memBitmap);
MemDC.Rectangle(m_nX,m_nY,m_nX+m_nWidth,m_nY+m_nHeight);}
draw()函數
{
this->GetClientRect(&rect);
MemDC.FillSolidRect(&rect,0x00FFFFFF);
MemDC.Ellipse(m_nX, m_nY,m_nX+m_nWidth,m_nY+m_nHeight);
CRgn rgn;
rgn.CreateEllipticRgn(m_nX, m_nY,m_nX+m_nWidth,m_nY+m_nHeight);
CBrush brush;
brush.CreateSolidBrush(0x00000000);
MemDC.FillRgn(&rgn,&brush);
CDC *pDC = this->GetDC();
pDC->BitBlt(m_nX,m_nY,rect.right,rect.bottom,&MemDC,0,0,SRCCOPY);
}
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12560256/viewspace-604101/ ,如需转载,请注明出处,否则将追究法律责任。