1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- // ImageListDyn.cpp: implementation of the CImageListDyn class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "DataManager.h"
- #include "ImageListDyn.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- CImageListDyn::CImageListDyn()
- {
- }
- CImageListDyn::~CImageListDyn()
- {
- CImageList::DeleteImageList();
- }
- int CImageListDyn::GetImage(CString strIconFile)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
- // ASSERT(FALSE);
- int nImage = -1;
- if(!m_mapIcons.Lookup(strIconFile, (void*&)nImage))
- {
- CString strIconPath = strIconFile;
-
- HICON hIcon = (HICON)LoadImage(NULL, strIconPath, IMAGE_ICON, 16, 16, LR_LOADFROMFILE|LR_SHARED|LR_LOADTRANSPARENT);
- if(hIcon == NULL)
- {
- CString strIcon = GetMapDir("Icon");
- strIconPath = theApp.m_strDllPath + "\\" + strIcon + "\\" + strIconFile + ".ico";
- hIcon = (HICON)LoadImage(NULL, strIconPath, IMAGE_ICON, 16, 16, LR_LOADFROMFILE|LR_SHARED|LR_LOADTRANSPARENT);
- }
- if(hIcon != NULL)
- {
- nImage = this->Add(hIcon);
- //DestroyIcon(hIcon);
- m_mapIcons.SetAt(strIconFile, (LPVOID)nImage);
- }
- }
- return nImage;
- }
- BOOL CImageListDyn::Create()
- {
- // return CImageList::Create(IDB_BITMAP_TREE_IMAGE, 16, 16, RGB(255,255,255));
- return CImageList::Create(16, 16, ILC_COLOR32, 0, 32);
- }
|