Windows要绘制窗口的时候,就会Notify这个消息了,不需要的时候就不会发的。
不信你双屏试一试绘制好了以后,一般就不调用了。双屏哦!

解决方案 »

  1.   

    case WM_PAINT: 
    hdc1=GetDC(hwnd_son); 
    x1=20; 
    y1=10; 
    x2=30; 
    y2=20; brush_r[i]=CreateSolidBrush(RGB(255,0,255])); 
    SelectObject(hdc1,brush_r[i]); 
    Ellipse(hdc1, x1, y1, x2, y2); 
                            ReleaseDC(hwnd_son,hdc1); default: 
    return DefWindowProc(hwnd,uMsg,wParam,lParam); ==============
    在WM_PAINT中必须要调用BeginPaint和EndPaint,否则无效区始终存在,而系统检测到有无效区会不停地发WM_PAINT消息。
      

  2.   

    MSDN:void UpdateWindow( );
    Updates the client area by sending a WM_PAINT message if the update region is not empty.所以我想会不会是你多了这一句代码而造成了每次调用OnPaint时都会再发送一次WM_PAINT消息呢?把这句
    UpdateWindow注释掉试试看吧,希望有帮助哈