就是通过浏览计算机上图片,为个人信息上补充JPG格式的照片。
以及如何设置图片的大小和位置

解决方案 »

  1.   

    用个ImageEditCtrl控件,然后就可以用来展示图像了
      

  2.   

    使用CStatic类,以及opencv的相关函数
    CStatic m_pic;
    Iplimage pImg = cvLoadImage(filename,CV_LOAD_IMAGE_GRAYSCALE);  //读取你电脑的图片
    int id = m_pic.GetDlgCtrlID();
    CDC *pDC = GetDlgItem(id)->GetDC();
    HDC hdc = pDC->GetSafeHdc();
    CvvImage cimg.CopyOf(pImg ,1);
    cimg.DrawToHDC(hdc,CRect(0,0,80,60));    //将图片画到你的Static控件上,0,0,80,60就是位置和宽高
      

  3.   

    用PICTURE(STATIC)控件。至于在管理系统中,你可能还需要记录图片的路径或者是存储文件。至于把图片复制管理还是统一写入自定义格式文件还是以字节流形式写入数据库就看你自的需求了。
      

  4.   

    哦,对了,CStatic要先Create
    m_pic.Create("",SS_BITMAP | WS_CHILD | WS_VISIBLE,CRect(0,0,80,60,this,NULL);
      

  5.   

    void DrawImage(LPCTSTR szImagePath, HWND hWnd, int nPosX, int nPosY, int nWidth, int nHeight)
    {
    ::CoInitialize(NULL); HRESULT hr;
    CFile file; file.Open(szImagePath, CFile::modeRead | CFile::shareDenyNone);
    DWORD dwSize = (DWORD)file.GetLength();
    HGLOBAL hMem = ::GlobalAlloc(GMEM_MOVEABLE, dwSize);
    LPVOID lpBuf = ::GlobalLock(hMem);
    file.Read(lpBuf, dwSize);
    file.Close();
    ::GlobalUnlock(hMem); IStream *pStream = NULL;
    IPicture *pPicture = NULL; hr = ::CreateStreamOnHGlobal(hMem, TRUE, &pStream);
    ASSERT(SUCCEEDED(hr)); hr = ::OleLoadPicture(pStream, dwSize, TRUE, IID_IPicture, (void**)&pPicture);
    ASSERT(hr == S_OK); long nPicWidth, nPicHeight;
    pPicture->get_Width(&nPicWidth);
    pPicture->get_Height(&nPicHeight); HDC hDC = ::GetDC(hWnd); pPicture->Render(hDC, nPosX, nPosY, nWidth, nHeight, 0, nPicHeight, nPicWidth, - nPicHeight, NULL);
    if(pPicture)
    pPicture->Release(); if(pStream)
    pStream->Release(); ::CoUninitialize();
    }