void CMyTreeView::OnDraw(CDC* pDC) 
{
   CRect rectShow;
     CWnd *pWnd=GetDlgItem(IDC_BUTTON1);
     pWnd->GetClientRect(rectShow);
     pWnd->ClientToScreen(&rectShow);
     pDC=pWnd->GetDC();
     m_Dib.SetPalette( pDC );
    //显示
     m_Dib.Draw(                        
        pDC,0,0,rectShow.right- rectShow.left,rectShow.bottom-  rectShow.top);
     ReleaseDC(pDC);
}

解决方案 »

  1.   

    问题:1:CDC* pDC  Ondraw既然传递进来了CDC指针,你为什么还要自己定义pDC=pWnd->GetDC();ReleaseDC(pDC);我怀疑你的问题就出在这里!!2如果问题还不解决,就在Ondraw里面写AfxMessageBox("OnDraw");运行,你可以看看,在你读图的时候OnDraw究竟调用了多少次!笨的解决方法,自己写显示函数
    比如
    Refresh()
    {CRect rectShow;
         CWnd *pWnd=GetDlgItem(IDC_BUTTON1);
         pWnd->GetClientRect(rectShow);
         pWnd->ClientToScreen(&rectShow);
         pDC=pWnd->GetDC();
         m_Dib.SetPalette( pDC );
        //显示
         m_Dib.Draw(                        
            pDC,0,0,rectShow.right- rectShow.left,rectShow.bottom-  rectShow.top);
         ReleaseDC(pDC);
    }根据需要自己调用,
      

  2.   

    不行啊
    每次我缩小放大窗口时 才会调用Ondraw()
    所以只会闪一下