首先生成CBitamp和内存cd,然后拷备到屏幕上
CRect rect;
GetClientRect(&rect);
CBitmap bitmap;
bitmap.CreateCompatibleBitmap(pDC, rect.Width(), rect.Height());//生成空间的内存位图
CDC me;
me.CreateCompatibleDC(pDC);//生成内存cd
me.SelectObject(&bitmap);
CPen pen;
pen.CreatePen(PS_SOLID, 1, RGB(255, 255, 255));//调整画笔
me.SelectObject(&pen);
me.MoveTo(pDoc->x1, pDoc->y1);
me.LineTo(pDoc->x2, pDoc->y2);
me.SetROP2(R2_WHITE);
pDC->BitBlt(0, 0, rect.Width(), rect.Height(), &me, 0, 0, SRCCOPY);//拷备