BOOL SetInterWnd::OnInitDialog() { if (!CMzWndEx::OnInitDialog()) { return FALSE; } m_ScrollWin.SetID(MZ_IDC_SETINTERWND_SCROLLWIN); m_ScrollWin.SetPos(0, 0, GetWidth(), GetHeight() - MZM_HEIGHT_TEXT_TOOLBAR); m_ScrollWin.EnableScrollBarV(true); AddUiWin(&m_ScrollWin); m_btnCount[0].SetID(MZ_IDC_SETINTERWND_BTN_3); m_btnCount[1].SetID(MZ_IDC_SETINTERWND_BTN_5); m_btnCount[2].SetID(MZ_IDC_SETINTERWND_BTN_10); m_btnCount[3].SetID(MZ_IDC_SETINTERWND_BTN_15); ImagingHelper *imgSelected = ImagingHelper::GetImageObject(GetMzResModuleHandle(), MZRES_IDR_PNG_SELECTED, true); for(int i=0; i < _MAXT; i++) { m_btnCount[i].SetPos(0,MZM_HEIGHT_BUTTONEX*i,GetWidth(),MZM_HEIGHT_BUTTONEX); wstringstream temp; int num; if(0==i) num=3; else num=(i-1)*5+5; temp << num << L"分钟"; m_btnCount[i].SetText(temp.str().c_str()); m_btnCount[i].SetButtonType(MZC_BUTTON_LINE_BOTTOM); m_btnCount[i].EnableNotifyMessage(true); m_ScrollWin.AddChild(&m_btnCount[i]); m_btnCount[i].SetImage2(imgSelected); m_btnCount[i].SetImageWidth2(imgSelected->GetImageWidth()); m_btnCount[i].SetShowImage2(false); } m_toolbar.SetID(MZ_IDC_SETINTERWND_TOOLBAR); m_toolbar.SetPos(0, GetHeight() - MZM_HEIGHT_TEXT_TOOLBAR, GetWidth(), MZM_HEIGHT_TEXT_TOOLBAR); m_toolbar.SetButton(0, true, true, L"返回"); m_toolbar.EnableLeftArrow(true); m_toolbar.EnableNotifyMessage(true); AddUiWin(&m_toolbar); return TRUE; }
BOOL SetSourceWnd::OnInitDialog() { if (!CMzWndEx::OnInitDialog()) { return FALSE; } m_ScrollWin.SetID(MZ_IDC_SOURCEWND_SCROLLWIN); m_ScrollWin.SetPos(0, 0, GetWidth(), GetHeight() - MZM_HEIGHT_TEXT_TOOLBAR); m_ScrollWin.EnableScrollBarV(true); AddUiWin(&m_ScrollWin); ImagingHelper *imgSelected = ImagingHelper::GetImageObject(GetMzResModuleHandle(), MZRES_IDR_PNG_SELECTED, true); for(int i=0;i<SOURCE_MAX;i++){ m_btnCount[i].SetID(MZ_IDC_SOURCEWND_CLINET0+i); m_btnCount[i].SetPos(0,MZM_HEIGHT_BUTTONEX*i,GetWidth(),MZM_HEIGHT_BUTTONEX); m_btnCount[i].SetButtonType(MZC_BUTTON_LINE_BOTTOM); m_btnCount[i].EnableNotifyMessage(true); m_ScrollWin.AddChild(&m_btnCount[i]); m_btnCount[i].SetImage2(imgSelected); m_btnCount[i].SetImageWidth2(imgSelected->GetImageWidth()); m_btnCount[i].SetShowImage2(false); wstring temp=s2ws(string(client[i])); m_btnCount[i].SetText(temp.c_str()); } m_toolbar.SetID(MZ_IDC_SOURCEWND_TOOLBAR); m_toolbar.SetPos(0, GetHeight() - MZM_HEIGHT_TEXT_TOOLBAR, GetWidth(), MZM_HEIGHT_TEXT_TOOLBAR); m_toolbar.SetButton(0, true, true, L"返回"); m_toolbar.EnableLeftArrow(true); m_toolbar.EnableNotifyMessage(true); AddUiWin(&m_toolbar); return TRUE; }
void GMList::DrawItem(HDC hdcDst,int nIndex,RECT* prcItem,RECT* prcWin,RECT* prcUpdate) { ListItem* pItem = GetItem(nIndex); if(0==pItem) return; if(0== pItem->Data ) return; MsgListItemData* pmlid = (MsgListItemData*)pItem->Data; // 背景色 RECT bgRect = *prcItem; bgRect.top = bgRect.top + 1; bgRect.bottom = bgRect.bottom - 1; if(0 == nIndex % 2) { HBRUSH bgBrush = CreateSolidBrush(RGB(230, 230, 250)); ::FillRect(hdcDst, &bgRect, bgBrush); } if(GetSelectedIndex() == nIndex ) MzDrawSelectedBg(hdcDst,prcItem); //if(pItem->Text == L"Next"){ if(pmlid->StringAuthor == L"Next" && pmlid->StringText == L"Next"){ HBRUSH bgBrush = CreateSolidBrush(RGB(220, 220, 220)); ::FillRect(hdcDst, &bgRect, bgBrush); ::SetTextColor(hdcDst,RGB(255,255,255)); MzDrawText(hdcDst,L"下一页", prcItem,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS); //_last_author=L"NULL"; return; } // 绘制左边的小图像 //ImagingHelper *pimg = ImagingHelper::GetImageObject(MzGetInstanceHandle(), IDR_PNG_LOGO, true); ImagingHelper *pimg = ImagingHelper::GetImageObject(MzGetInstanceHandle(), IDR_PNG_SMS, true); RECT rcImg = *prcItem; rcImg.right = rcImg.left + MZM_MARGIN_MAX*2; if (pimg) { //if((!(_last_author == pmlid->StringAuthor))) pimg->Draw(hdcDst, &rcImg, false, false); } // for author RECT rcText=*prcItem; rcText.left=MZM_MARGIN_MAX*2; rcText.right=rcText.right - 200; rcText.bottom=rcText.top+28; ::SetTextColor(hdcDst,RGB(0,200,0)); //if((!(_last_author == pmlid->StringAuthor))) MzDrawText(hdcDst,pmlid->StringAuthor.C_Str(), &rcText,DT_LEFT|DT_BOTTOM|DT_SINGLELINE|DT_END_ELLIPSIS); //_last_author=pmlid->StringAuthor ; //for timetrim rcText.left = rcText.right; rcText.right = rcText.left+200; ::SetTextColor(hdcDst,RGB(200,200,200)); HFONT hf_=FontHelper::GetFont(16); SelectObject(hdcDst,hf_); MzDrawText(hdcDst,pmlid->StringTime.C_Str(), &rcText,DT_RIGHT|DT_TOP |DT_SINGLELINE|DT_END_ELLIPSIS); // for message rcText.top=rcText.bottom; rcText.bottom=prcItem->bottom; rcText.left=MZM_MARGIN_MAX*2; rcText.right=rcText.right-MZM_MARGIN_MAX; ::SetTextColor(hdcDst,RGB(0,100,0)); //::SetTextColor(hdcDst,RGB(200,200,200)); HFONT hf=FontHelper::GetFont(24); SelectObject(hdcDst,hf); MzDrawText(hdcDst,pmlid->StringText.C_Str(), &rcText, DT_LEFT | DT_WORDBREAK | DT_EDITCONTROL | DT_END_ELLIPSIS | DT_NOPREFIX); }
bool CglWnd::selectImageFile() { CMzString strFilePath(MAX_PATH); TCHAR defDir[MAX_PATH] = {0}; bool bSelect = false; bool ret = false; g_config->GetValue(L"Last", L"Path", L"\\Disk\\Photo", defDir, MAX_PATH); bSelect = selectFile(m_hWnd, strFilePath, CMzString(L"*.jpg;*.png;"), defDir); if (bSelect) { showWaiting(m_hWnd); ImagingHelper img; MemoryDC memDc; if (img.LoadImage(strFilePath.C_Str(), true, true)) { HDC dc; if (img.GetImageWidth() == 480 && img.GetImageHeight() == 720) { dc = img.GetDC(); } else { memDc.Create(480, 720); RECT r; HBRUSH hBrush = CreateSolidBrush(RGB(0,0,0)); SetRect(&r, 0, 0, 480, 720); FillRect(memDc.GetDC(), &r, hBrush); DeleteObject(hBrush); int w,h; if (img.GetImageWidth()*3 > img.GetImageHeight()*2) { w = 480; h = w*img.GetImageHeight()/img.GetImageWidth(); } else { h = 720; w = h*img.GetImageWidth()/img.GetImageHeight(); } SetRect(&r, 240 - w/2, 360 - h/2, 240 + w/2, 360 + h/2); img.Draw(memDc.GetDC(), &r, true, true); dc = memDc.GetDC(); } if (setImageFromDC(dc)) { ret = true; removeAllBubbles(); if (extractDir(strFilePath.C_Str(), defDir)) g_config->SetValue(L"Last", L"Path", defDir); } } hideWaiting(); } return ret; }