继承了一个CStatic类,并绑定了对话框上的一个静态文本框,想直接在OnEraseBkgnd进行背景和其他图形的重绘,但发现当没有响应WM_PAINT时OnEraseBkgnd中根本绘不出东西,而加上OnPaint后便好了,即便OnPaint中什么也没有之前一直没有注意到这个问题,昨天才发现请问这是何故

解决方案 »

  1.   

    The DefWindowProc function validates the update region. The function may also send the WM_NCPAINT message to the window procedure if the window frame must be painted and send the WM_ERASEBKGND message if the window background must be erased. 
      

  2.   

    但问题是我跟踪时候发现OnEraseBkgnd也已经被执行了,但就是看不到结果
      

  3.   

    在控件里用WM_PAINT绘图,不需要用 WM_ERASEBKGND 
      

  4.   


    但为什么OnEraseBkgnd中没效果呢
      

  5.   

    最好别在OnEraseBkgnd里画图,一般直接返回True然后在OnPaint里绘图你看看这个:http://www.cppblog.com/AloneInSkyline/archive/2010/01/14/105653.aspx如果还解决不了把代码贴出来大家看看