How to save DC's content as bitmap!
-
at first, because my poor english,I wish you can understand me! If I draw some lines or pictures in a DC,How can I get the bitmap data and save it as a bitmap? thank you for your help! Don't look at me in that way!
-
at first, because my poor english,I wish you can understand me! If I draw some lines or pictures in a DC,How can I get the bitmap data and save it as a bitmap? thank you for your help! Don't look at me in that way!
CBitmap m_pGenBitmap = new CBitmap(); CClientDC dc(NULL); int nWidth = 128; int nHeight = 128; HDC hDCScreen = dc.GetSafeHdc(); HBITMAP hbm = ::CreateCompatibleBitmap(hDCScreen,nWidth,nHeight); if (hbm != NULL) { HDC hDCGlyphs = ::CreateCompatibleDC(hDCScreen); HBITMAP hbmOld = (HBITMAP)::SelectObject(hDCGlyphs, hbm); CDC *pDC2 = CDC::FromHandle(hDCGlyphs); CRect r(0,0,nWidth,nWidth); // your owner draw pDC2->FillRect(&r,&CBrush(RGB(0xff,0xff,0xff))); m_pFillUnit->Draw(pDC2,&r,0); // end SelectObject(hDCGlyphs, hbmOld); m_pGenBitmap->m_hObject = hbm; ::DeleteDC(hDCGlyphs); } return m_pGenBitmap;
-
at first, because my poor english,I wish you can understand me! If I draw some lines or pictures in a DC,How can I get the bitmap data and save it as a bitmap? thank you for your help! Don't look at me in that way!
Check out Mike Dunns FAQ, I think it was something about that there... or see in the Bitmaps & Palettes section here on CP or Search this forum, because you're not the first who asking! :) ------------------------------------ Rickard Andersson, Suza Computing ICQ#: 50302279 I'm from the winter country SWEDEN! ------------------------------------