MFC介面應用
阿新 • • 發佈:2018-11-01
void CMFC_InstrumentRecogDlg::OnBnClickedButton1() { m_list1.ResetContent();//重置路徑列表 aryFilename.clear(); BOOL isOpen = TRUE; //是否開啟(否則為儲存) CString defaultDir = L""; //預設開啟的檔案路徑 CString fileName = L""; //預設開啟的檔名 CString filter = L"檔案 (*.jpg; *.png)|*.jpg;*.png||"; //檔案過慮的型別 //CFileDialog openFileDlg(isOpen, defaultDir, fileName, // OFN_HIDEREADONLY | OFN_READONLY, filter, NULL); CFileDialog openFileDlg(isOpen, defaultDir, fileName, OFN_ALLOWMULTISELECT | OFN_ENABLESIZING | OFN_HIDEREADONLY, filter, NULL); INT_PTR result = openFileDlg.DoModal(); CString filePath = fileName; if (result == IDOK) { /*vector<CString> aryFilename;*/ POSITION posFile = openFileDlg.GetStartPosition(); while (posFile != NULL) { aryFilename.push_back(openFileDlg.GetNextPathName(posFile)); } for (int i = 0; i<aryFilename.size(); i++) { m_list1.AddString(aryFilename[i]); } } // TODO: 在此新增控制元件通知處理程式程式碼 }
void CMFC_InstrumentRecogDlg::OnBnClickedButton2() { USES_CONVERSION; //char* pFileName[20]; for (int i = 0; i < 2; i++) { pFileName[i] = T2A(aryFilename[i]); } Match match1; double time; CString timeStr; match1.match_show(pFileName, time, i_cbox); timeStr.Format(_T("%.2f"), time); CWnd::SetDlgItemTextW(IDC_EDIT3, timeStr); // TODO: 在此新增控制元件通知處理程式程式碼 }
void CMFC_InstrumentRecogDlg::OnBnClickedButton3() { GetPointerData PointerRecog; float theta; double time; CString timeStr; PointerRecog.getdata(theta, time); CString thetaStr; thetaStr.Format(_T("%.1f"), theta); CWnd::SetDlgItemTextW(IDC_EDIT1, thetaStr); timeStr.Format(_T("%.2f"), time); CWnd::SetDlgItemTextW(IDC_EDIT3, timeStr); // TODO: 在此新增控制元件通知處理程式程式碼 } void CMFC_InstrumentRecogDlg::OnCbnSelchangeCombo1() { i_cbox = m_combox.GetCurSel(); // TODO: 在此新增控制元件通知處理程式程式碼 }