void CMy08301Dlg::OnPaint()

{

CPaintDC dc(this);

CDC dcMem;

CBitmap bmpMem;

dcMem.CreateCompatibleDC(&dc);

bmpMem.CreateCompatibleBitmap(&dc,800,480);

dcMem.SelectObject(&bmpMem);

 

CDC dcMem2;

dcMem2.CreateCompatibleDC(&dcMem);

 

CBitmap bmpMem2;

CString ok=L"//……//ok.bmp/0";

CString cancel=L"//……//cancel.bmp/0";

 

 

bmpMem2.m_hObject=SHLoadDIBitmap(ok);

dcMem2.SelectObject(&bmpMem2);

dcMem.BitBlt(700,350,82,36,&dcMem2,0,0,SRCCOPY);  //加载位图ok

//---------------------------------------------------------------------------------------

bmpMem2.m_hObject=SHLoadDIBitmap(cancel);

dcMem2.SelectObject(&bmpMem2);

dcMem.BitBlt(707,8,70,45,&dcMem2,0,0,SRCCOPY);     //加载位图cancel

//重复上面三句代码 加载多幅位图

//--------------------------------------------------------------------------------------

 

dc.BitBlt(0,0,800,480,&dcMem,0,0,SRCCOPY);

 

bmpMem2.DeleteObject();

dcMem2.DeleteDC();

 

bmpMem.DeleteObject();

dcMem.DeleteDC();

}

当前DC  dc;
兼容DC1  dcMem;
兼容DC2  dcMem2;
双缓冲:1: 重复利用dcMem2加载位图到dcMem,
            2:讲dcMem画面加载至当前dc。
优点:将多幅位图复制到兼容DC1:dcMem中,再复制到当前dc中,不会出现一副副图片依次出现的现象
         如果只加载一副图片就没必要双缓冲了。

备注:windows桌面系统下:

1.没有SHLoadDIBitmap

2.貌似也不能重复用dcMem2,我定义了多个兼容DC将位图加载到dcMem中。