怎样对屏幕的指定区域进行刷新?

解决方案 »

  1.   

    InvalidateRect()函数CWnd::InvalidateRect
    void InvalidateRect( LPCRECT lpRect, BOOL bErase = TRUE );
      

  2.   

    使用InvalidateRect函数就可以了。
    The InvalidateRect function adds a rectangle to the specified window's update region. The update region represents the portion of the window's client area that must be redrawn. BOOL InvalidateRect(
      HWND hWnd,  // handle of window with changed update region
      CONST RECT *lpRect,
                  // address of rectangle coordinates
      BOOL bErase // erase-background flag
    );ParametershWnd 
    Handle to the window whose update region has changed. If this parameter is NULL, the system invalidates and redraws all windowslpRect 
    Pointer to a RECT structure that contains the client coordinates of the rectangle to be added to the update region. If this parameter is NULL, the entire client area is added to the update region. 
    bErase 
    Specifies whether the background within the update region is to be erased when the update region is processed. If this parameter is TRUE, the background is erased when the BeginPaint function is called. If this parameter is FALSE, the background remains unchanged例子:
    CRect rect;
    memset(&rect, 0, sizeof(CRect));
    this->GetClientRect(&rect);
    InvalidateRect(rect);