我在做图像检索的系统,使用CxImage类库,没有链接cximage.lib之前,会有好多函数没法用,链接cximage.lib之后,运行结果只是一个空白对话框,原本设计的界面没有出现,不知道哪儿错了!

解决方案 »

  1.   

    我只做打开关键图的模块,代码如下:
    void Coppic::Onopenpic() 
    {
    // TODO: Add your control notification handler code here
    CString strNamaFile;

    char szFilter[] = "Bmp File (*.bmp)\0*.bmp\0All Files (*.*)\0*.*\0\0";//文件滤波器
    CFileDialog dlg(TRUE);
    dlg.m_ofn.lpstrFilter = szFilter; if( dlg.DoModal() == IDOK )
    {
    strNamaFile = dlg.GetPathName();
    m_imgLoaded.Load(strNamaFile, CXIMAGE_FORMAT_BMP);

    RefreshDisplay();

    }}
    void Coppic::RefreshDisplay()
    {
    if( m_imgLoaded.IsValid() )
    {
    CRect r;
    CWnd *p = (CWnd*) GetDlgItem(IDC_STATIC_PIC);
    CDC *pDC = p->GetDC();
    p->GetWindowRect(&r); m_imgLoaded.Stretch(pDC->m_hDC, 0, 0, r.Width(), r.Height());
    p->ReleaseDC(pDC);
    } // TODO: Add your control notification handler code here

    }
    设计的对话框就一个按钮和图像框,结果只有一个空白的对话框。
      

  2.   

    m_imgLoaded.Draw(pDC->m_hDC, 0, 0, r.Width(), r.Height()); 
      

  3.   

    m_imgLoaded.Draw(pDC->m_hDC, 0, 0, r.Width(), r.Height()); 
      

  4.   

    if( m_imgLoaded.IsValid() )   看这个条件是否为TRUE