| 发表于:2007-09-06 14:04:08 楼主 |
void cmainwnd::try_to_open() { cfiledialog filedlg(true, null, null, null, _t( "jpg files (*.jpg) ¦*.jpg ¦bmp files (*.bmp) ¦*.bmp ¦text files (*.txt) ¦*.txt ¦music files (*.mp3) ¦*.mp3 ¦all files (*.*) ¦*.* ¦ ¦ "), null); if(idok == filedlg.domodal()) { m_cs_path = filedlg.getpathname(); m_pimage = image::fromfile(m_cs_path); /* p[0].x = 0; * p[0].y = 0; * p[1].x = 800; * p[1].y = 0; * p[2].x = 0; * p[2].y = 600; */ invalidaterect(crect(0,0,800,800),false); } } void cmainwnd::onpaint() { //bool bsuccess = m_image.load(m_cs_path); cpaintdc clientdc(this); graphics graphics(clientdc.m_hdc); if(m_cs_path.getlength() != 0) { graphics.drawimage(m_pimage,0,0,800,600); } } 为何m_pimage = image::fromfile(m_cs_path)无法加载图片? 可怜今天只有10分了,昨天系统不给分我,贴子都没有人看,今天只好重发一次。。。。 另外小声问一下,建的是基于对话框的mfc工程,在头文件里如何引入gdi+的函数? |
|
|
|
|