// ShowPic3.cpp : implementation file // #include "stdafx.h" #include "dbserver.h" #include "ShowPic3.h" #include "./helper/ffsco.h" #include "DelPhotoSet.h" #include #include "Lzari.h" #include "mysqldata.h" #define THUMBNAIL_WIDTH 100 #define THUMBNAIL_HEIGHT 90 #include "ConnectThread.h" #include "ShowPhoto.h" using namespace helper_coffs; ///////////////////////////////////////////////////////////////////////////// // ShowPic3 dialog IDC_BU IDC_COMBO2 ShowPic3::ShowPic3(CWnd* pParent /*=NULL*/): CDialog(ShowPic3::IDD, pParent) { //{{AFX_DATA_INIT(ShowPic3) m_check1 = 1; //}}AFX_DATA_INIT m_bTerminate = false; m_bRunning = false; m_hThread = NULL; } void ShowPic3::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(ShowPic3) DDX_Control(pDX, IDC_COMBO1, m_combo1); DDX_Control(pDX, IDC_LIST2, m_List2); DDX_Control(pDX, IDC_LIST1, m_List1); DDX_Check(pDX, IDC_CHECK1, m_check1); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(ShowPic3, CDialog) //{{AFX_MSG_MAP(ShowPic3) ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1) ON_WM_DESTROY() ON_BN_CLICKED(IDC_BUTdelall, OnBUTdelall) ON_BN_CLICKED(IDC_BUTdel, OnBUTdel) ON_LBN_SELCHANGE(IDC_LIST2, OnSelchangeList2) ON_BN_CLICKED(IDC_BTNshow1, OnBTNshow1) ON_BN_CLICKED(IDC_BTNshow2, OnBTNshow2) ON_BN_CLICKED(IDC_BTNshow3, OnBTNshow3) ON_BN_CLICKED(IDC_BTNshow4, OnBTNshow4) ON_BN_CLICKED(IDC_BUTdel1, OnBUTdel1) ON_BN_CLICKED(IDC_BUTdel2, OnBUTdel2) ON_BN_CLICKED(IDC_BUTdel3, OnBUTdel3) ON_BN_CLICKED(IDC_BUTdel4, OnBUTdel4) ON_WM_CTLCOLOR() ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // ShowPic3 message handlers extern int FindArray(CStringArray *pArray, CString Str); extern void GetPathFromNetShareName(CString name, CString &sRet); BOOL ShowPic3::OnInitDialog() { CDialog::OnInitDialog(); CString str = "\r\n 1. 备份硬盘要与原保存硬盘要为2块独立硬盘(保存在同一块硬盘起不到保护作用)。\r\n\ 2. 备份硬盘满后可以更换一块新的备份硬盘(如需帮助,请与利亚方舟技术联系)\r\n\ 3. 备份硬盘满后可以按文件夹修改日期从前往后的顺序刻进光盘后删除\r\n\ 4. 如不需要保存备份,可以在管理备份照片中手工删除备份"; GetDlgItem(IDC_STATIC1)->SetWindowText(str); m_combo1.AddString("全部"); m_combo1.AddString("取完件1个月"); m_combo1.AddString("取完件2个月"); m_combo1.AddString("取完件3个月"); m_combo1.AddString("取完件6个月"); m_combo1.AddString("取完件9个月"); m_combo1.AddString("取完件12个月"); m_combo1.AddString("取完件18个月"); m_combo1.AddString("取完件24个月"); m_combo1.AddString("取完件36个月"); m_combo1.SetCurSel(0); CRect rc, rc2; GetWindowRect(rc2); DEVMODE g_dm; g_dm.dmSize = sizeof(DEVMODE); EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &g_dm); int wid = g_dm.dmPelsWidth * 3 / 4; int hei = g_dm.dmPelsHeight * 3 / 4; ::MoveWindow(m_hWnd, 0, 0, wid, hei, TRUE); CenterWindow(); GetClientRect(rc); GetDlgItem(IDC_STATIC1)->GetWindowRect(rc2); ScreenToClient(rc2); rc2.left = 0; rc2.right = rc.right; GetDlgItem(IDC_STATIC1)->MoveWindow(rc2); GetDlgItem(IDC_STATIC2)->MoveWindow(rc2); m_List2.GetWindowRect(rc2); ScreenToClient(rc2); int dt = rc2.left; rc2.bottom = rc.bottom - dt; m_List2.MoveWindow(rc2); m_List1.GetWindowRect(rc2); ScreenToClient(rc2); rc2.bottom = rc.bottom - dt; rc2.right = rc.right - dt; m_List1.MoveWindow(rc2); { m_List1array.RemoveAll(); for (int a = g_dbpool.GetSize() - 1; a >= 0; a--) { CDatabase *pCurdb = NULL; ODBCConnGuard ConnGuard(pCurdb , -1, 3000); if ( pCurdb == NULL ) continue; CString filter = "status3='OK'"; CRecordset myset(pCurdb); CString sql = "select count(*) as cot from dindan"; if (!filter.IsEmpty())sql += " where " + filter; myset.Open(CRecordset::forwardOnly, sql); myset.GetFieldValue("cot", sql); myset.Close(); int count = atol(sql); sql.Format("%d", a - 1); // if(a==0)sql="-1"; int oldsize = m_List1array.GetSize(); m_List1array.SetSize(oldsize + count, 1); CRstDindanForm rsSt; rsSt.m_pDatabase = pCurdb; if (!filter.IsEmpty())rsSt.m_strFilter = filter; rsSt.m_strSort = "id"; rsSt.Open(); int ii = 0; while (!rsSt.IsEOF()) { m_List1array.ElementAt(oldsize + ii).RemoveAll(); m_List1array.ElementAt(oldsize + ii).Add(rsSt.id); m_List1array.ElementAt(oldsize + ii).Add(rsSt.name1); m_List1array.ElementAt(oldsize + ii).Add(rsSt.name2); m_List1array.ElementAt(oldsize + ii).Add(rsSt.time5); ii++; rsSt.MoveNext(); if (m_List1array.GetSize() <= (oldsize + ii))break; } rsSt.Close(); m_List1array.SetSize(oldsize + ii, 1); } } { CDatabase *pMaindb = NULL; ODBCConnGuard ConnGuard(pMaindb , -1, 3000); if ( pMaindb ) { CRstversion rsSt; rsSt.m_pDatabase = pMaindb; rsSt.Open(); if (!rsSt.IsEOF()) { g_path1 = rsSt.m_bakserver1; g_path2 = rsSt.m_bakserver2; g_path4 = rsSt.m_bakserver3; g_path3 = rsSt.m_bakserver4; } rsSt.Close(); } } #ifdef CHILD_VERSION if(g_path1.Find(":")==-1&& g_path1!="") g_path1="\\\\"+g_path1+"\\客户原片备份(儿童管理软件)$"; if(1)//(localname.CompareNoCase (g_path1)==0 || CompareIP(localname, g_path1)==0) && CheckFolderFileExist("\\\\"+g_path1+"\\客户原片备份(儿童管理软件)$")) GetPathFromNetShareName("客户原片备份(儿童管理软件)$", g_path1); if(g_path2.Find(":")==-1&& g_path2!="") g_path2="\\\\"+g_path2+"\\修好的片备份(儿童管理软件)$"; if(1)//((localname.CompareNoCase (g_path2)==0 || CompareIP(localname, g_path2)==0) && CheckFolderFileExist("\\\\"+g_path1+"\\修好的片备份(儿童管理软件)$")) GetPathFromNetShareName("修好的片备份(儿童管理软件)$", g_path2); if(g_path4.Find(":")==-1&& g_path4!="") g_path4="\\\\"+g_path4+"\\精修好的片备份(儿童管理软件)$"; if(1)//((localname.CompareNoCase (g_path4)==0 || CompareIP(localname, g_path4)==0) && CheckFolderFileExist("\\\\"+g_path1+"\\精修好的片备份(儿童管理软件)$")) GetPathFromNetShareName("精修好的片备份(儿童管理软件)$", g_path4); if(g_path3.Find(":")==-1&& g_path3!="") g_path3="\\\\"+g_path3+"\\设计好的片备份(儿童管理软件)$"; if(1)//((localname.CompareNoCase (g_path3)==0 || CompareIP(localname, g_path3)==0) && CheckFolderFileExist("\\\\"+g_path1+"\\设计好的片备份(儿童管理软件)$")) GetPathFromNetShareName("设计好的片备份(儿童管理软件)$", g_path3); #else if (g_path1.Find(":") == -1 && g_path1 != "") g_path1 = "\\\\" + g_path1 + "\\客户原片备份(管理软件)$"; if (1)//((localname.CompareNoCase (g_path1)==0 || CompareIP(localname, g_path1)==0) && CheckFolderFileExist("\\\\"+g_path1+"\\客户原片备份(管理软件)$")) GetPathFromNetShareName("客户原片备份(管理软件)$", g_path1); if (g_path2.Find(":") == -1 && g_path2 != "") g_path2 = "\\\\" + g_path2 + "\\修好的片备份(管理软件)$"; if (1)//((localname.CompareNoCase (g_path2)==0 || CompareIP(localname, g_path2)==0) && CheckFolderFileExist("\\\\"+g_path1+"\\修好的片备份(管理软件)$")) GetPathFromNetShareName("修好的片备份(管理软件)$", g_path2); if (g_path4.Find(":") == -1 && g_path4 != "") g_path4 = "\\\\" + g_path4 + "\\精修好的片备份(管理软件)$"; if (1)//((localname.CompareNoCase (g_path4)==0 || CompareIP(localname, g_path4)==0) && CheckFolderFileExist("\\\\"+g_path1+"\\精修好的片备份(管理软件)$")) GetPathFromNetShareName("精修好的片备份(管理软件)$", g_path4); if (g_path3.Find(":") == -1 && g_path3 != "") g_path3 = "\\\\" + g_path3 + "\\设计好的片备份(管理软件)$"; if (1)//((localname.CompareNoCase (g_path3)==0 || CompareIP(localname, g_path3)==0) && CheckFolderFileExist("\\\\"+g_path1+"\\设计好的片备份(管理软件)$")) GetPathFromNetShareName("设计好的片备份(管理软件)$", g_path3); #endif LoadPhotos(); for (int i = 0; i < m_List1array.GetSize(); i++) { str = m_List1array.ElementAt(i).ElementAt(0); if (FindArray(&m_dirarray1, str) == -1) { if (FindArray(&m_dirarray2, str) == -1) { if (FindArray(&m_dirarray3, str) == -1) { if (FindArray(&m_dirarray4, str) == -1) { continue; } } } } str += "\r\n"; str += m_List1array.ElementAt(i).ElementAt(1); str += m_List1array.ElementAt(i).ElementAt(2); if (m_List2.GetCount() % 2) m_List2.AddEntry(str, RGB(204, 204, 204), m_List2.GetCount()); else m_List2.AddEntry(str, RGB(190, 190, 190), m_List2.GetCount()); m_idarray.Add(str); m_datearray.Add(m_List1array.ElementAt(i).ElementAt(3)); } m_List2.Invalidate(); m_ImageListThumb.Create(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, ILC_COLOR24, 0, 1); m_List1.SetImageList(&m_ImageListThumb, LVSIL_NORMAL); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } extern void LoadImageFromFile(Image **img, CString path); extern void LoadImageFromBuf(Image **img, CString path); int GetOrientation(Image *image) { try { if (image) { UINT totalBufferSize; UINT numProperties; image->GetPropertySize(&totalBufferSize, &numProperties); // Allocate the buffer that will receive the property items. PropertyItem* pAllItems = (PropertyItem*)malloc(totalBufferSize); // Fill the buffer. image->GetAllPropertyItems(totalBufferSize, numProperties, pAllItems); // Print the id data member of each property item. for (UINT j = 0; j < numProperties; ++j) { if (PropertyTagOrientation == pAllItems[j].id) { short* ptrLong = (short*)(pAllItems[j].value); int ret = (int)*ptrLong; free(pAllItems); return ret; } } free(pAllItems); } } catch (...) { } return 1; } unsigned __stdcall LoadThumbNail20(LPVOID lpParam) { try { ShowPic3 *pDlg = (ShowPic3*)lpParam; CListCtrl *ListCtrl = &pDlg->m_List1; CImageList* pImgList = &pDlg->m_ImageListThumb; // reset our image list for (int i = 0; i < pImgList->GetImageCount(); i++) pImgList->Remove(i); // remove all items from list view ListCtrl->DeleteAllItems(); pImgList->SetImageCount(pDlg->m_vFileName.size()); TCHAR path[MAX_PATH]; vector::iterator iter; // Set redraw to FALSE to avoid flickering during adding new items ListCtrl->SetRedraw(FALSE); int nIndex = 0; CString str, spath; for (iter = pDlg->m_vFileName.begin(); iter != pDlg->m_vFileName.end() && pDlg->m_bTerminate != true; iter++, nIndex++) { str = *iter; spath.Empty(); if (str.Left(str.ReverseFind('\\') + 1) != pDlg->m_path) { spath = str.Left(str.ReverseFind('\\') + 1); spath = spath.Right(spath.GetLength() - pDlg->m_path.GetLength()); } str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1); str = spath + str.Left(str.GetLength() - 4); ListCtrl->InsertItem(nIndex, str, nIndex); } ListCtrl->SetRedraw(TRUE); ListCtrl->Invalidate(); const float fRatio = (float)THUMBNAIL_HEIGHT / THUMBNAIL_WIDTH; int XDest, YDest, nDestWidth, nDestHeight; nIndex = 0; SolidBrush whitebrush(Color(255, 255, 255, 255)); for (iter = pDlg->m_vFileName.begin(); iter != pDlg->m_vFileName.end() && pDlg->m_bTerminate != true; iter++, nIndex++) { // Load Image File Image *image = NULL; Bitmap *pBmp = NULL; str = *iter; spath = str.Left(str.ReverseFind('\\') + 1); spath += "s"; spath += str.Right(str.GetLength() - str.ReverseFind('\\') - 1); if (::CheckFileExist(spath)) ::LoadImageFromBuf(&image, spath); else { str.MakeLower(); if (str.Right(3) != "jpg")continue; ::LoadImageFromBuf(&image, str); } if (image == NULL)continue; int orientation = GetOrientation(image); if (orientation == 8) image->RotateFlip(Rotate270FlipNone); else if (orientation == 6) image->RotateFlip(Rotate90FlipNone); if (image->GetWidth() == 0) continue; // Calculate Rect to fit to canvas const float fImgRatio = (float)image->GetHeight() / image->GetWidth(); if (fImgRatio > fRatio) { nDestWidth = THUMBNAIL_HEIGHT / fImgRatio; XDest = (THUMBNAIL_WIDTH - nDestWidth) / 2; YDest = 0; nDestHeight = THUMBNAIL_HEIGHT; } else { XDest = 0; nDestWidth = THUMBNAIL_WIDTH; nDestHeight = THUMBNAIL_WIDTH*fImgRatio; YDest = (THUMBNAIL_HEIGHT - nDestHeight) / 2; } pBmp = new Bitmap(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, PixelFormat24bppRGB); Graphics graph2(pBmp); graph2.Clear(Color(255, 192, 192, 192)); graph2.FillRectangle(&whitebrush, 1, 1, THUMBNAIL_WIDTH - 2, THUMBNAIL_HEIGHT - 2); Graphics graph(pBmp); Rect desRect(XDest, YDest, nDestWidth, nDestHeight); // Draw Image graph.DrawImage(image, desRect, 0, 0, image->GetWidth(), image->GetHeight(), UnitPixel); delete image; // Attach to Bitmap and Replace image in CImageList CBitmap bitmap; HBITMAP hbmp; pBmp->GetHBITMAP(Color(255, 255, 255, 255), &hbmp); bitmap.Attach(hbmp); pImgList->Replace(nIndex, &bitmap, NULL); delete pBmp; // Redraw only a current item for removing flickering and fast speed. ListCtrl->RedrawItems(nIndex, nIndex); // Release used DC and Object } ListCtrl->Invalidate(); pDlg->m_bRunning = false; pDlg->m_bTerminate = false; _endthreadex(0); return 0; } catch (...) { } return 1; } void ShowPic3::LoadThumbImages() { TerminateThread(); m_hThread = (HANDLE)_beginthreadex(NULL, 0, LoadThumbNail20, (LPVOID)this, 0/* CREATE_SUSPENDED*/, &m_dwThreadID); m_bRunning = true; } BOOL ShowPic3::TerminateThread() { if (!m_bRunning) return TRUE; m_bTerminate = true; for (;;) { if (::WaitForSingleObject(m_hThread, 0) == WAIT_OBJECT_0) break; MSG msg; while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { if (!AfxGetApp()->PumpMessage()) break; } } ::CloseHandle(m_hThread); return TRUE; } extern void LoadImageFromBuf(Image **img, CString path); void ShowPic3::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult) { // TODO: Add your control notification handler code here POSITION pos; pos = m_List1.GetFirstSelectedItemPosition(); if (pos == NULL) { return; } int iItem = m_List1.GetNextSelectedItem(pos); Image *m_pImg = NULL; ::LoadImageFromBuf(&m_pImg, m_patharray1.ElementAt(iItem)); ShowPhoto dlg; dlg.m_pImg = m_pImg; dlg.DoModal(); delete m_pImg; /* ShowPic22 dlg; dlg.m_pos=iItem; dlg.m_pPathArray=&m_patharray1; dlg.DoModal ();*/ *pResult = 0; } void ShowPic3::OnDestroy() { TerminateThread(); CDialog::OnDestroy(); // TODO: Add your message handler code here } extern BOOL myisdigit(CString str); void ShowPic3::LoadPhotos() { if (g_path1 == "")return; CString str; if (1) { ffsco o; o.dirs(0); o.find(LPCSTR(g_path1), LPCSTR("*.*")); ffsco::typeT coo; ffsco::typeT::iterator it; coo = o.co_dir(); for (it = coo.begin(); coo.end() != it; it++) { str = (*it).c_str(); if (str == g_path1 + "\\")continue; str.TrimRight("\\"); str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1); m_dirarray1.Add(str); } } } void ShowPic3::OnBUTdel() { DelPhotoSet dlg; dlg.DoModal(); } void ShowPic3::OnSelchangeList2() { // TODO: Add your control notification handler code here UpdateData(); int pos = m_List2.GetCurSel(); if (pos == -1)return; CString str; m_List2.GetText(pos, str); pos = str.Find("\r\n"); if (pos == -1)return;; m_id = str.Left(pos); ShowPhoto1(); if (m_patharray1.GetSize() == 0)OnBTNshow2(); if (m_patharray1.GetSize() == 0)OnBTNshow3(); if (m_patharray1.GetSize() == 0)OnBTNshow4(); } void ShowPic3::ShowPhoto1() { if (m_id == "") { AfxMessageBox("请先选中客人!", MB_ICONINFORMATION); return; } CString str; m_path = g_path1 + "\\" + m_id + "\\"; m_patharray1.RemoveAll(); if (1) { ffsco o; o.dirs(1); o.find(LPCSTR(m_path), LPCSTR("*.jpg")); ffsco::typeT coo; ffsco::typeT::iterator it; coo = o.co_file(); for (it = coo.begin(); coo.end() != it; it++) { str = (*it).c_str(); if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue; if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue; str.MakeLower(); m_patharray1.Add(str); } } if (m_bRunning)return; CStringArray *pArray = &m_patharray1; m_vFileName.clear(); for (int i = 0; i < pArray->GetSize(); i++) { CString filePath = pArray->ElementAt(i); filePath.MakeLower(); m_vFileName.push_back(filePath); } LoadThumbImages(); } void ShowPic3::ShowPhoto2() { if (m_id == "") { AfxMessageBox("请先选中客人!", MB_ICONINFORMATION); return; } CString str; m_path = g_path2 + "\\" + m_id + "\\"; m_patharray1.RemoveAll(); if (1) { ffsco o; o.dirs(1); o.find(LPCSTR(m_path), LPCSTR("*.jpg")); ffsco::typeT coo; ffsco::typeT::iterator it; coo = o.co_file(); for (it = coo.begin(); coo.end() != it; it++) { str = (*it).c_str(); if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue; if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue; str.MakeLower(); m_patharray1.Add(str); } } if (m_bRunning)return; CStringArray *pArray = &m_patharray1; m_vFileName.clear(); for (int i = 0; i < pArray->GetSize(); i++) { CString filePath = pArray->ElementAt(i); filePath.MakeLower(); m_vFileName.push_back(filePath); } LoadThumbImages(); } void ShowPic3::ShowPhoto3() { if (m_id == "") { AfxMessageBox("请先选中客人!", MB_ICONINFORMATION); return; } CString str; m_path = g_path3 + "\\" + m_id + "\\"; m_patharray1.RemoveAll(); if (1) { ffsco o; o.dirs(1); o.find(LPCSTR(m_path), LPCSTR("*.jpg")); ffsco::typeT coo; ffsco::typeT::iterator it; coo = o.co_file(); for (it = coo.begin(); coo.end() != it; it++) { str = (*it).c_str(); if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue; if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue; str.MakeLower(); m_patharray1.Add(str); } } if (m_bRunning)return; CStringArray *pArray = &m_patharray1; m_vFileName.clear(); for (int i = 0; i < pArray->GetSize(); i++) { CString filePath = pArray->ElementAt(i); filePath.MakeLower(); m_vFileName.push_back(filePath); } LoadThumbImages(); } void ShowPic3::ShowPhoto4() { if (m_id == "") { AfxMessageBox("请先选中客人!", MB_ICONINFORMATION); return; } CString str; m_path = g_path4 + "\\" + m_id + "\\"; m_patharray1.RemoveAll(); if (1) { ffsco o; o.dirs(1); o.find(LPCSTR(m_path), LPCSTR("*.jpg")); ffsco::typeT coo; ffsco::typeT::iterator it; coo = o.co_file(); for (it = coo.begin(); coo.end() != it; it++) { str = (*it).c_str(); if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue; if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue; str.MakeLower(); m_patharray1.Add(str); } } if (m_bRunning)return; CStringArray *pArray = &m_patharray1; m_vFileName.clear(); for (int i = 0; i < pArray->GetSize(); i++) { CString filePath = pArray->ElementAt(i); filePath.MakeLower(); m_vFileName.push_back(filePath); } LoadThumbImages(); } void ShowPic3::OnBTNshow1() { // TODO: Add your control notification handler code here ShowPhoto1(); } void ShowPic3::OnBTNshow2() { // TODO: Add your control notification handler code here ShowPhoto2(); } void ShowPic3::OnBTNshow3() { // TODO: Add your control notification handler code here ShowPhoto4(); } void ShowPic3::OnBTNshow4() { // TODO: Add your control notification handler code here ShowPhoto3(); } void ShowPic3::OnBUTdelall() { // TODO: Add your control notification handler code here if (m_id == "") { AfxMessageBox("请先选中您要删除的客人!", MB_ICONINFORMATION); return; } if (AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO | MB_ICONSTOP) != IDYES)return; DeleteDirectory(g_path1 + "\\" + m_id + "\\"); DeleteDirectory(g_path2 + "\\" + m_id + "\\"); DeleteDirectory(g_path3 + "\\" + m_id + "\\"); DeleteDirectory(g_path4 + "\\" + m_id + "\\"); OnBTNshow1(); } void ShowPic3::OnBUTdel1() { // TODO: Add your control notification handler code here if (m_id == "") { AfxMessageBox("请先选中您要删除的客人!", MB_ICONINFORMATION); return; } if (AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO | MB_ICONSTOP) != IDYES)return; DeleteDirectory(g_path1 + "\\" + m_id + "\\"); OnBTNshow1(); } void ShowPic3::OnBUTdel2() { // TODO: Add your control notification handler code here if (m_id == "") { AfxMessageBox("请先选中您要删除的客人!", MB_ICONINFORMATION); return; } if (AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO | MB_ICONSTOP) != IDYES)return; DeleteDirectory(g_path2 + "\\" + m_id + "\\"); OnBTNshow2(); } void ShowPic3::OnBUTdel3() { // TODO: Add your control notification handler code here if (m_id == "") { AfxMessageBox("请先选中您要删除的客人!", MB_ICONINFORMATION); return; } if (AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO | MB_ICONSTOP) != IDYES)return; DeleteDirectory(g_path4 + "\\" + m_id + "\\"); OnBTNshow3(); } void ShowPic3::OnBUTdel4() { // TODO: Add your control notification handler code here if (m_id == "") { AfxMessageBox("请先选中您要删除的客人!", MB_ICONINFORMATION); return; } if (AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO | MB_ICONSTOP) != IDYES)return; DeleteDirectory(g_path3 + "\\" + m_id + "\\"); OnBTNshow4(); } HBRUSH ShowPic3::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); // TODO: Change any attributes of the DC here if (nCtlColor == CTLCOLOR_STATIC && pWnd->GetDlgCtrlID() == IDC_STATIC1) { pDC->SetBkMode(TRANSPARENT); //设置字体背景为透明 return (HBRUSH)::GetStockObject(WHITE_BRUSH); // 设置背景色 } // TODO: Return a different brush if the default is not desired return hbr; } void ShowPic3::OnSelchangeCombo1() { // TODO: Add your control notification handler code here int pos = m_combo1.GetCurSel(); if (pos != -1) { CString str; m_combo1.GetLBText(pos, str); int days = -1; if (str == "全部")days = -1; else if (str == "取完件1个月")days = 31; else if (str == "取完件2个月")days = 31 + 30; else if (str == "取完件3个月")days = 31 * 2 + 30; else if (str == "取完件6个月")days = 31 * 3 + 30 * 3; else if (str == "取完件9个月")days = 31 * 5 + 30 * 4; else if (str == "取完件12个月")days = 365; else if (str == "取完件18个月")days = 365 + 31 * 3 + 30 * 3; else if (str == "取完件24个月")days = 365 * 2; else if (str == "取完件36个月")days = 365 * 3; m_List2.ResetContent(); CString date; CTime today = CTime::GetCurrentTime(); CTimeSpan dt; for (int i = 0; i < m_datearray.GetSize(); i++) { date = m_datearray.ElementAt(i); // MessageBox(date); CTime tm = GetTmFromStr(date); dt = today - tm; // str.Format("%d", dt.GetDays()); // MessageBox(str); if (days != -1 && dt.GetDays() < days)continue; str = m_idarray.ElementAt(i); if (m_List2.GetCount() % 2) m_List2.AddEntry(str, RGB(204, 204, 204), m_List2.GetCount()); else m_List2.AddEntry(str, RGB(190, 190, 190), m_List2.GetCount()); } m_List2.Invalidate(); } }