程序中调用了 Invalidate()后,万一等不到 WM_PAINT 消息怎么办呀?
Invalidate()后,只是告诉windows,窗口的客户区无效了,但是窗口并不会立刻重绘,
因为要等 WM_PAINT 消息,但是如果这个消息一直不出现呢?
还有,updatewindow()函数,可以实现窗口立刻重绘,但是为何不用 updatewindow(),而要用 invalidate()呢?
为何“绕一圈”再解决问题呢?

解决方案 »

  1.   

    以下摘自MSDN:
    void CTestView::OnChangeRect() 
    {
       // Change Rectangle size.
       m_rcBox = CRect(20, 20, 210, 210);   // Invalidate window so entire client area 
       // is redrawn when UpdateWindow is called.
       Invalidate();      // Update Window to cause View to redraw.
       UpdateWindow();
    }
    Invalidate()的意义应该是刷新区域背景吧
      

  2.   

    The UpdateWindow member function sends a WM_PAINT message directly, bypassing the application queue. If the update region is empty, WM_PAINT is not sent. 
      

  3.   

    你不要想太多
    只要你的程序没有重大逻辑问题WM_PAINT跑不了
      

  4.   

    updatewindow也是重绘无效区域,如果没有无效区域,updatewindow不干什么
      

  5.   

    UpdateWindow就可以啊不放心的话