>_<: The same with previous introduction. In the InitInstance fanction make a littlechange:
>_<:yes just add another picture "dra.bmp" and give the handle to DRA. And then call function Mypaint (...)
1Hdc=GetDC (hWnd);2Mdc=CreateCompatibleDC (HDC);3 4Bg= (HBITMAP) LoadImage (NULL,"bg.bmp", Image_bitmap, -, the, lr_loadfromfile);5Dra= (HBITMAP) LoadImage (NULL,"dra.bmp", Image_bitmap, -,124, lr_loadfromfile);6 //name, type, size, loading mode;7 8 Mypaint (HDC);9ReleaseDC (HWND,HDC);
>_<:as following here is the mypaint (...) function:
>_<:in This function :
- firstly , move the picture "bg.bmp" to Compatibledc MDC by its handle BG.
- then copy MDC to HDC. Until now there was no change.
- and then move dra to mdc,latter using twice BitBlt.
Here we can see: the seventh line, only USE&NBSP;MDC ' S lower part do an operation Srcand; The eighth line,use another part of the MDC does an operation srcpaint. for why through the steps can achieve transparency? it involves some knowledge of image science, here would not introduce.)
>_<! However, One thing must be reminded : The picture of dra.bmp must use following style form:
&NBSP; Yes,the part so you don ' t want to show must use the black background and this part would be done the operation late than Another part. and Another part includes so you want to show must is black, you don ' t want t O Show must be white!
>_<:mypaint (...)
1 voidMypaint (hdc hdc)2 {3 SelectObject (MDC,BG);4BITBLT (HDC,0,0,1366,768Mdc0,0, srccopy);//in window position, size, original cut bit5 6 SelectObject (Mdc,dra);7BITBLT (HDC, $, the, -, +Mdc0, +, Srcand);8BITBLT (HDC, $, the, -, +Mdc0,0, srcpaint);9}