void CfingerDlg::OnPaint() {
     CPaintDC dc(this);
     p = pImage;
     for(i = imstartY; i < Height/ImageFactor; i++){
         for(j = imstartX; j < Width/ImageFactor; j++){
            c =  *(p + i*ImageFactor*Width + j*ImageFactor);
                    c = ((c & 0x0007)<<21) | ((c & 0x0007)<<13) | ((c & 0x0007)<<5);
                     if (((j+LcdStartX)<LcdHeight) && ((i+LcdStartY)<LcdWidth))
                      {
                       dc.SetPixel(i,LcdHeight-j,c);
                      }
       }}}}mfc窗口重绘 怎么才能转成bmp在picture box显示? 

解决方案 »

  1.   

    void CfingerDlg::OnPaint() { 
        CPaintDC dc(this); 
        CDC memdc;
        memdc.CreateCompatibleDC( &dc );
        CRect rc;
        GetClientRect( &rc );
        CBitmap bmp;
        bmp.CreateCompatibleBitmap( &dc, rc.Width(), rc.Height() );
        CBitmap *pOld = ( CBitmap * )memdc.SelectObject( &bmp );    p = pImage; 
        for(i = imstartY; i < Height/ImageFactor; i++){ 
            for(j = imstartX; j < Width/ImageFactor; j++){ 
                c =  *(p + i*ImageFactor*Width + j*ImageFactor); 
                        c = ((c & 0x0007) < <21) | ((c & 0x0007) < <13) | ((c & 0x0007) < <5); 
                        if (((j+LcdStartX) <LcdHeight) && ((i+LcdStartY) <LcdWidth)) 
                          { 
                          memdc.SetPixel(i,LcdHeight-j,c); 
                          } 
          }}}
        dc.BitBlt( 0, 0, rc.Width(), rc.Height(), &memdc, 0, 0, SRCCOPY );
        memdc.SelectObject( pOld );
      

  2.   

    就是这个是mfc的窗口重绘 怎么才能让它重绘后把图片输出成bmp格式 并存在硬盘上
      

  3.   

    就是这个是mfc的窗口重绘 怎么才能让它重绘后把图片输出成bmp格式 并存在硬盘上