为什么不能直接用getdc 
之类的函数呢?请解释一下原理吧! 

解决方案 »

  1.   

    参考一下:
    BeginPaint()与GetDC()的区别
      

  2.   

    调用BeginPaint和EndPaint之后,无效区才会消除掉,否则,系统会不停地发WM_PAINT消息。
      

  3.   

    The BeginPaint function prepares the specified window for painting and fills a PAINTSTRUCT structure with information about the painting. If the function succeeds, the return value is the handle to a display device context for the specified window.The BeginPaint function automatically sets the clipping region of the device context to exclude any area outside the update region. The update region is set by the InvalidateRect or InvalidateRgn function and by the system after sizing, moving, creating, scrolling, or any other operation that affects the client area. If the update region is ed for erasing, BeginPaint sends a WM_ERASEBKGND message to the window. 
      

  4.   

    BeginPaint呼叫中,如果显示区域的背景还未被删除,则由Windows来删除。它使用注册窗口类别的WNDCLASS结构的hbrBackground字段中指定的画刷来删除背景。BeginPaint呼叫令整个显示区域有效,并传回一个「设备内容句柄」。设备内容是指实体输出设备(如视讯显示器)及其设备驱动程序。在窗口的显示区域显示文字和图形需要设备内容句柄。但是从BeginPaint传回的设备内容句柄不能在显示区域之外绘图.EndPaint释放设备内容句柄,使之不再有效。