DIBLIST.CPP
上传用户:lvjun8202
上传日期:2013-04-30
资源大小:797k
文件大小:1k
- // DibList.cpp: implementation of the CDibList class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "OAM.h"
- #include "DibList.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- CDibList::CDibList()
- {
- m_nEveryCx = m_nEveryCy = 0;
- }
- CDibList::~CDibList()
- {
- }
- BOOL CDibList::Load(LPCSTR strFileName,int nImages,COLORREF bkClr)
- {
- DeleteImageList();
- m_nEveryCx = m_nEveryCy = 0;
- HBITMAP hBitmap;
- hBitmap = (HBITMAP)LoadImage(AfxGetInstanceHandle(),strFileName,
- IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION);
-
- if(hBitmap == NULL)
- return FALSE;
- BITMAP bm;
- CBitmap * pBitmap = CBitmap::FromHandle(hBitmap);
- GetObject(hBitmap,sizeof(BITMAP),&bm);
- if(Create(bm.bmWidth/nImages, bm.bmHeight, ILC_COLORDDB|ILC_MASK, nImages, 1)
- && Add(pBitmap, bkClr) != -1)
- {
- m_nEveryCx = bm.bmWidth/nImages;
- m_nEveryCy = bm.bmHeight;
- return TRUE;
- }
- return FALSE;
- }
- CSize CDibList::GetEverySize()
- {
- return CSize(m_nEveryCx,m_nEveryCy);
- }
- void CDibList::DrawEx(CDC *pdc, int nImage, CRect rect, UINT nStyle)
- {
- }