看MSDN中关于WIN32 API CreateCompatibleDC的介绍中有一句:When you no longer need the memory DC, call the DeleteDC function.
所以CreateCompatibleDC一定要DeleteDC
但是:你用的是CDC类的CreateCompatibleDC,这个可以不主动调用DeleteDC 的,因为CDC类变量在析构的时候会自动调用DeleteDC
In general, do not call this function; the destructor will do it for you. from msdn
CDC memDC; 你用的是对象,对象作用域结束后会干嘛?, 指针的话就需要了
GetDc()获取到的dc不能用deleteDc只能用releaseDc