how to paint a bitmap to the dialog client dc from the memory dc
C / C++ / MFC
2
Posts
2
Posters
0
Views
1
Watching
-
Ive tried to capture a particular area of the screen to the memory dc.
// rc has been defined as CRect and its coordinates are based on the dialog client area CDC dcDisplay, dcMem; CBitmap btmDisplay, \*pbtmOld; int nWidth = GetSystemMetrics( SM\_CXSCREEN ); int nHeight = GetSystemMetrics( SM\_CYSCREEN ); dcDisplay.CreateDCW( (LPCTSTR)"DISPLAY", NULL, NULL, NULL ); btmDisplay.CreateCompatibleBitmap( &dcDisplay, nWidth, nHeight ); dcMem.CreateCompatibleDC( &dcDisplay ); pbtmOld = dcMem.SelectObject( &btmDisplay ); // the captured area has the same size as the rc ClientToScreen( &rc ); dcMem.BitBlt( 0, 0, rc.Width(), rc.Height(), &dcDisplay, rc.left, rc.top, SRCCOPY ); dcMem.SelectObject( pbtmOld );
Now i wanna paint this bitmap to the dialog dc. But i dunno how to write the codes. Can anyone help? PS: the above codes may have faults
-
Ive tried to capture a particular area of the screen to the memory dc.
// rc has been defined as CRect and its coordinates are based on the dialog client area CDC dcDisplay, dcMem; CBitmap btmDisplay, \*pbtmOld; int nWidth = GetSystemMetrics( SM\_CXSCREEN ); int nHeight = GetSystemMetrics( SM\_CYSCREEN ); dcDisplay.CreateDCW( (LPCTSTR)"DISPLAY", NULL, NULL, NULL ); btmDisplay.CreateCompatibleBitmap( &dcDisplay, nWidth, nHeight ); dcMem.CreateCompatibleDC( &dcDisplay ); pbtmOld = dcMem.SelectObject( &btmDisplay ); // the captured area has the same size as the rc ClientToScreen( &rc ); dcMem.BitBlt( 0, 0, rc.Width(), rc.Height(), &dcDisplay, rc.left, rc.top, SRCCOPY ); dcMem.SelectObject( pbtmOld );
Now i wanna paint this bitmap to the dialog dc. But i dunno how to write the codes. Can anyone help? PS: the above codes may have faults