什么时候应该用GetDC,什么时候应该用GetWindowDC?这两个函数可以混用吗? 网上有的说法是,绘图要用GetDC。但是绘图不是要用BeginPaint吗? 还请高人解释一下这两个函数各自的用法,谢谢!

解决方案 »

  1.   

    The GetDC function retrieves a handle to a display device context (DC) for the client area of a specified window or for the entire screen. The GetWindowDC function retrieves the device context (DC) for the entire window, including title bar, menus, and scroll bars. The BeginPaint function prepares the specified window for painting and fills a PAINTSTRUCT structure with information about the painting. GetDC--客户区dc或整个桌面
    GetWindowDC--整个窗口,包括客户区和非客户区
    BeginPaint--需与EndPaint配对,只能在WM_PAINT中调用,用于自动裁剪更新区域,如果更新区域需要erase,则发送一个WM_ERASEBKGND消息
      

  2.   

    其实有一点我比较好奇,GetWindowDC返回的DC我可以更改它的剪裁区域把它变大吗