我在做一个很传统的程序,就是用鼠标在windows桌面屏幕上画线条。像“画图”里的画笔那样的一个东西。每次把屏幕画得乱乱的以后,我想用使它刷新,把画上去的线条去掉,请问应该怎么做呢?

解决方案 »

  1.   

    试试InvalidateCWnd::Invalidate
    void Invalidate( BOOL bErase = TRUE );ParametersbEraseSpecifies whether the background within the update region is to be erased.ResInvalidates the entire client area of CWnd. The client area is ed for painting when the next WM_PAINT message occurs. The region can also be validated before a WM_PAINT message occurs by the ValidateRect or ValidateRgn member function.The bErase parameter specifies whether the background within the update area is to be erased when the update region is processed. If bErase is TRUE, the background is erased when the BeginPaint member function is called; if bErase is FALSE, the background remains unchanged. If bErase is TRUE for any part of the update region, the background in the entire region, not just in the given part, is erased. Windows sends a WM_PAINT message whenever the CWnd update region is not empty and there are no other messages in the application queue for that window.
      

  2.   

    桌面是 explorer管的, 不知道发送一条wm_paint消息给explorer有没有用