pDC参数呢?
是在那个函数中显示的呢,OnDraw?还是OnPaint呢,试试在这两个函数中实现你的位图显示

解决方案 »

  1.   

    在前面加一个: 
       pDC =GetDC();
      

  2.   

    在程序里看不到pDC的声明和定义呀????
      

  3.   

    如panda_w所说,一般只有在OnDraw或OnPaint函数中,才会有pDC传给你,这时你无需自己定义。如果是在其它函数中,则要自己获得DC,
    如pDC=GetDC();
      

  4.   

    并不是我不定义,而是因为定义后还是出错。而且我的参考资料上的例程中也没有对pDC进行定义,我也不知道究竟是怎么回事。还请各位大虾们再伤伤脑筋帮帮小弟!另外,这段程序在OnPaint函数中,如果我在程序中添加pDC=GetDC()的话:
    Compiling...
    xxxView.cpp
    D:\mywork\xxx\xxxView.cpp(139) : error C2065: 'pDC' : undeclared identifier
    D:\mywork\xxx\xxxView.cpp(139) : error C2440: '=' : cannot convert from 'class CDC *' to 'int'
            This conversion requires a reinterpret_cast, a C-style cast or function-style cast
    D:\mywork\xxx\xxxView.cpp(145) : error C2227: left of '->BitBlt' must point to class/struct/union
    Error executing cl.exe.
      

  5.   

    参考资料就不能漏印吗?
    你不能只按书上的例程抄。要动动脑筋。
    另外,你也不能只写pDC=GetDC();这样pDC还是没有定义。
    试试: CDC *pDC=GetDC();
      

  6.   

    ywzhan说的对,然后在子程序的最后加上ReleaseDC();即可。
      

  7.   

    你的MyBitmap是局部变量.退出OnPaint()会被释放.
    该成这样试试:
    ...
        CBitmap *pMyBitmap=new CBitmap;
        pMyBitmap->LoadBitmap(IDB_MAS);
    ...