bmp文件动态加载显示

CDC cMemDC;
cMemDC.CreateCompatibleDC(pDC);
CBitmap bmp;
BITMAP bitmap;
//The top arrow button
//bmp.LoadBitmap(IDB_VERTICLE_SCROLLBAR_UPARROW);

hbitmap[7]=(HBITMAP)::LoadImage(NULL,

_T("D:\\work\\学习\\MFC\\ScrollBar\\res\\Vscrolled_arrow_up_over.bmp"),

IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION);

bmp.Attach(hbitmap[7]);
bmp.GetBitmap(&bitmap);
cMemDC.SelectObject(&bmp);

pDC->StretchBlt(0, 0, cxButton, cyButton, &cMemDC, 0, 0, bitmap.bmWidth, bitmap.bmHeight, SRCCOPY);

bmp.DeleteObject();

//PShbitmap[7]不再有效


你可能感兴趣的:(bmp文件动态加载显示)