1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
void CTestSaveView::Dessin()
{
CDC* pDC = GetDC();
if(pDC != NULL)
{
CDC dcMem;
//Create a memory dc and select the drawing surface into it
if(dcMem.CreateCompatibleDC(pDC) == TRUE)
{
HBITMAP hOldBitmap = (HBITMAP)SelectObject(dcMem.GetSafeHdc(), m_Bm);
/////////////////////////////////////////////////////////////////////////////////////
dcMem.FillSolidRect(0, 0, m_Drawing.Width(), m_Drawing.Height(), RGB(255,0,0));
BOOL bResult = BitBlt(pDC->GetSafeHdc(), m_Drawing.left, m_Drawing.top, m_Drawing.Width(), m_Drawing.Height(),
dcMem.GetSafeHdc(), 0, 0, SRCCOPY);
//And deselect the drawing surface
SelectObject(dcMem.GetSafeHdc(), hOldBitmap);
}
ReleaseDC(pDC);
}
} |
Partager