void CStaffSetDlg::OnNMClickListStaffname(NMHDR *pNMHDR, LRESULT *pResult) { LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR); // TODO: 在此添加控件通知处理程序代码 int index=m_ListCtr_Staff.GetItemCount(); for(int i=0;i<m_ListCtr_Staff.GetItemCount();i++) { if(m_ListCtr_Staff.GetItemState(i, LVIS_SELECTED) == LVIS_SELECTED) { SLZStaff staffinfo=m_List_StaffInfo.GetAt(m_List_StaffInfo.FindIndex(i)); m_cs_StaffName=staffinfo.GetStaffName(); m_cs_StaffId=staffinfo.GetStaffId(); GENDER staffgender=staffinfo.GetStaffGender(); if (staffgender==MYGENDER_NONE)m_cs_StaffGender.SetCurSel(-1); else m_cs_StaffGender.SetCurSel(staffgender-1); CString photoadd=staffinfo.GetStaffPhoto(); if(staffinfo.GetStaffPhoto()=="") m_ListCtr_Staff.SetItemText(i,4,_T("未配置")); ShowPhoto(photoadd); UpdateData(FALSE); break; } } *pResult = 0; }
void CStaffSetDlg::OnBnClickedBnSetphoto() { // TODO: 在此添加控件通知处理程序代码 POSITION pos=m_ListCtr_Staff.GetFirstSelectedItemPosition(); int index=m_ListCtr_Staff.GetNextSelectedItem(pos); if (index<0) { AfxMessageBox(_T("请选择一名员工")); return; } CString m_strPhotoPath; CFileDialog fdlg(TRUE, 0, 0, 4|2, m_strPicFilter); if(IDOK == fdlg.DoModal()) { m_strPhotoPath = fdlg.GetPathName(); } SLZStaff staffinfo=m_List_StaffInfo.GetAt(m_List_StaffInfo.FindIndex(index)); staffinfo.SetStaffPhoto(m_strPhotoPath); m_ListCtr_Staff.SetItemState(index,LVIS_FOCUSED,LVIS_FOCUSED); ShowPhoto(m_strPhotoPath); if(staffinfo.GetStaffPhoto()!="") m_ListCtr_Staff.SetItemText(index,4,_T("已配置")); else m_ListCtr_Staff.SetItemText(index,4,_T("未配置")); m_List_StaffInfo.GetAt(m_List_StaffInfo.FindIndex(index))=staffinfo; // SetModified(); }
//---------------------------------------------------- void CPhoto::SeePrevImg() { if ( m_nCurr == 0) return ; m_nCurr -- ; m_szFileName = ui->ImgList->item(m_nCurr)->text() ; ui->ImgList->setCurrentRow( m_nCurr); ShowPhoto( false) ; }
//---------------------------------------------------- void CPhoto::LoadImage( bool bShow) { if( m_szFileName.isEmpty()) return ; ShowPhoto( true, bShow) ; m_nCurr ++ ; ui->ImgList->setCurrentRow( m_nCurr) ; SET_MOD }
//---------------------------------------------------- void CPhoto::on_ImgList_itemDoubleClicked( QListWidgetItem* item) { QString szTmp ; szTmp = item->text() ; if( ! szTmp.isEmpty()) { m_szFileName = szTmp ; ShowPhoto( false) ; } m_nCurr = ui->ImgList->row( item) ; }
//---------------------------------------------------- void CPhoto::SeeNextImg() { if ( m_nCurr == ui->ImgList->count() - 1) return ; m_nCurr ++ ; m_szFileName = ui->ImgList->item(m_nCurr)->text() ; ui->ImgList->setCurrentRow( m_nCurr) ; ShowPhoto( false) ; if ( m_pTimer->isActive()) { m_pTimer->stop(); m_pTimer->start(); } }
//---------------------------------------------------- void CPhoto::DeleteSingle() { QListWidgetItem* pItem ; if ( m_nCurr < 0) return ; pItem = ui->ImgList->takeItem( m_nCurr); m_pConf->RemoveFromList( pItem->text()); if ( m_nCurr == ui->ImgList->count()) m_nCurr -- ; if ( m_nCurr < 0) { ui->ImgView->ResetView( true) ; return ; } ui->ImgList->setCurrentRow( m_nCurr); m_szFileName = ui->ImgList->item( m_nCurr)->text() ; if( ! m_szFileName.isEmpty()) ShowPhoto( false) ; SET_MOD }
void CStaffSetDlg::ShowPhoto(const CString& strPhotoPath) { ShowPhoto(strPhotoPath,(CWnd*)&m_picPhoto); }