#include "UserList.h" #include "path.h" #include "protocol.h" #include using namespace std; #define PC_ICON L"pc.png" #define M8_ICON L"m8.png" CUserList::CUserList(void) { wstring localPath; ::GetCurrentDirectory(localPath); WCHAR fileName[200]; wsprintf(fileName, L"%s%s", localPath.c_str(), PC_ICON); m_PCImage.LoadImageW( fileName, true, false); wsprintf(fileName, L"%s%s", localPath.c_str(), M8_ICON); m_M8Image.LoadImageW( fileName, true, false); } CUserList::~CUserList(void) { } void CUserList::DrawItem(HDC hdcDst, int nIndex, RECT* prcItem, RECT *prcWin, RECT *prcUpdate) { if(GetSelectedIndex() == nIndex) MzDrawSelectedBg(hdcDst, prcItem); ListItem* pItem = this->GetItem(nIndex); HostSub* pHost = (HostSub*) pItem->Data; RECT rcIcon = *prcItem; rcIcon.right = rcIcon.left + 64; //rcIcon.bottom = rcIcon.top + 64; if( pHost->hostType == IPMSG_M8 ) { m_M8Image.Draw(hdcDst, &rcIcon, true, true); } else { m_PCImage.Draw(hdcDst, &rcIcon, true, true); } RECT rcText = *prcItem; rcText.left = rcIcon.right+ 10; MzDrawText(hdcDst, pItem->Text, &rcText, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS); }