曾经在OnDraw() 中用pdc->textout()  显示文字;
在leftbutoondown()中调用 ondraw() ,可以正常显示
现在 不直接调要 改用 InvalidateRect(rect,false);   调用  ,图片显示都是正确的,为什么pdc->textout() ,
却不能正常显示
.

解决方案 »

  1.   

    BOOL InvalidateRect(
      HWND hWnd,           // handle to window
      CONST RECT* lpRect,  // rectangle coordinates
      BOOL bErase          // erase state
    );
    Parameters
    hWnd 
    [in] Handle to the window whose update region has changed. If this parameter is NULL, the system invalidates and redraws all windows, and sends the WM_ERASEBKGND and WM_NCPAINT messages to the window procedure before the function returns. 
    lpRect 
    [in] 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 
    [in] 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. 
      

  2.   

     英语不是很厉害 ,大致讲的是 重绘时不擦除背景吧 . 我也是想用这一点,以前直接用调用ondraw(),闪的厉害 ,现在闪的好点 ,但还是闪 ,就是文字显示不出来了  . 这段说明 ,应该怎样来指导呢?
      

  3.   

    InvalidateRect(rect,false); 
    -->
    InvalidateRect(rect,TRUE); 
      

  4.   

    InvalidateRect(this->GetSafeHwnd(), CRect(CPoint(15, 145), rectSize), TRUE);注意你的rect的大小和位置关系
      

  5.   

    在OnDraw里直接写文字不行吗?
      

  6.   

    InvalidateRect(NULL,false); 是没有问题的,比用TRUE果快
    在OnDraw中,有两点要求:
    1. 不要用GetWindowDC要用CPaintDC,他们的过程和用途略有不同2. CPaintDC dc(this); //这一行必须在_parent::OnPaint()的前面,或去掉_parent::OnPaint()你dc.TextOut看看结果
      

  7.   


    好像没有  ,      我并没有 这一行代码   _parent::OnPaint()