Me.AutoRedraw = True
要想让MFC中视图也能“AutoRedraw”,要怎么做呢?

解决方案 »

  1.   

    调用Invalidate()发送一个刷新消息
      

  2.   

    UpdateWindow()
    或者Invalidate()
      

  3.   

    那要是Invalidate()的话,怎么会这样?void CTextView::OnTexteffect() 
    {
    CRect rc;
    GetClientRect(&rc);
    CClientDC DC(this);
    Invalidate();
    DC.DrawText("Jay",&rc,DT_CENTER);
    }
    按理说,应该是先刷新视图区,再显示一下Jay的!!!
    可是怎么没有????请给以解释!!!!
      

  4.   

    刷新调用的是CXXVIEW::ondraw(cdc* p);
    关于绘图的部分应该写在这个函数里面
      

  5.   

    回复人: lzd(雨中绝音) ( ) 信誉:100  2003-02-12 17:10:00  得分:0 
     
     
      现在已经是你所要表达的的啦...就是先刷新视图区.再显示了..
      
     
    /////////////////////////////////////没有啊??????
    我这里试完了,就是白茫茫一片呀?????????????
      

  6.   

    Invalidate();
    这个函数会调用CXXVIEW::ondraw(cdc* p);
    里边没有你的DC.DrawText("Jay",&rc,DT_CENTER);代码
      

  7.   

    建议Invalidate(),再UpdateWindow()试试
      

  8.   

    我就是想知道为什么我先执行Invalidate();(随之它发送WM_PAINT)后,再DrawText(),而这句DrawText却没起到作用?????加分了!!!!!!!!!!!!!!!!100分
      

  9.   

    哈哈:回复人: wanmin0830(万旻) ( ) 信誉:100  2003-02-12 17:22:00  得分:0 
     
     
      建议Invalidate(),再UpdateWindow()试试
      
     
    的确有用!!!!!但是为什么呢?单一使用Invalidate()不管用????
      

  10.   

    Invalidate  --> OnDraw()
    你想刷新什么,都写在ONDRAW里面
    什么时候想刷新,就调用INVALIDATE
      

  11.   

    '我就是想知道为什么我先执行Invalidate();(随之它发送WM_PAINT)后,再DrawText(),而这句DrawText却没起到作用?????'关注!
      

  12.   

    正确答案:
    The invalidated areas accumulate in the update region until the region is processed when the next WM_PAINT message occurs or until the region is validated by using the ValidateRect or ValidateRgn function. The system sends a WM_PAINT message to a window whenever its update region is not empty and there are no other messages in the application queue for that window.