How to draw a bitmap from the memory.
-
I now can obtain a pointer points to the place where a bitmap stored in the memory, but I'm wandering how to display it on a dialogue based programme. Thank you for your attention. the simplier the better!
-
Select the bitmap into a new device context, (must be compatible, CreateCompatibleDC() does this); then just CDC->BitBlt(); on the OnPaint() proc of the dialog app
-
rw104,thank you for your instructions, but I want to display the bitmap on a dialogue, so can you give me some more delights. the simplier the better!
CDC imgDC;//temp CDC to render the bitmap into imgDC.CreateCompatibleDC(pdc); //pdc is the standard screen dialog CDC, imgDC needs to be compat.. CBitmap yourBitmap; yourBitmap.LoadBitmap(IDB_RESOURCEIMAGE); //IDB_RESOURCEIMAGE is an image resource //You already have a pointer to a bitmap so you do not need these two lines. imgDC.SelectObject(yourBitmap);//bitmap gets selected into the dc //bitblt the image , you 'll need to decide co-ordiantes pdc->BitBlt(0,0,100,100,&imgDC,0,0,SRCCOPY); That's it;P