003
17.07.2008, 12:50 Uhr
Tommix
|
C++: |
void CProbebitmapDlg::OnPaint() { CPen Pen_rot; Pen_rot.CreatePen(PS_SOLID,2,rot); CPaintDC dc(this); // device context for painting dcMemory.CreateCompatibleDC(&dc); CRect rect; GetClientRect(rect); CBitmap bitmap; bitmap.CreateCompatibleBitmap(&dc, rect.Width(), rect.Height())); CBitmap* pOldBitmap = dcMemory.SelectObject(&bitmap); CPen* pOldPen = dcMemory.SelectObject(&Pen_rot); dcMemory.MoveTo(0,0); dcMemory.LineTo(100,100); dc.BitBlt(0,0,200,100,&dcMemory,0,0,SRCAND); //SRCCOPY SRCCOPY); dcMemory.SelectObject(pOldPen); // MSDN: // "An application should not call DeleteObject on a CGdiObject // object that is currently selected into a device context. " dcMemory.SelectObject(pOldBitmap); dcMemory.DeleteDC(); Pen_rot.DeleteObject(); }
|
|