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; }
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; }