1.IDC_EDIT
赋值(修改)
CString cFilePath = dlg->GetPathName();
m_test = cFilePath;
CWnd *wnd = GetDlgItem(IDC_EDIT1);
wnd->SetWindowText(m_test);
读取
m_edit.GetWindowTextA(m_test);
2.打开文件窗口
static char file_ex[] = "Image files|*.jpg;*.gif;*.png;*.bmp|All files(*.*)|*.*||";//图片格式
CFileDialog* dlg = new CFileDialog(TRUE, NULL, NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, file_ex, NULL);
if (IDOK == dlg->DoModal())
{
}
3.图片读取及显示
CPaintDC dc(this);CImage image;if (m_test != ""){CWnd *p = GetDlgItem(IDC_STATIC1);CRect rect;p->GetWindowRect(rect);ScreenToClient(rect);image.Load(m_test);image.Draw(dc, rect);}