The background brush of the window class is used by the default message processor to repaint the background in response to WM_ERASEBKGND. If you are doing all your painting in WM_PAINT, or continuously in the render loop, then yes, you will not need a background brush. Note that if you use GetStockObject( BLACK_BRUSH ) to set the brush of the window class, then you won't need to delete the brush, because stock objects are shared between apps.
but why in almost every example, direct2d always renders in WM_PAINT and direct3d renders when no message processing
Well, it depends on how you want your application to behave, it has nothing to do with the application using D2D or D3D. If you want the application to render continuously, then you do all the rendering in the message loop when there are no messages. This is used when the contents displayed by the application is dynamic and changes frequently. If the contents change only when the user does something to change it (like painting programs for example), then the application will update its display only when needed, and in response to WM_PAINT.
Edited by Amr0, 06 May 2013 - 07:24 AM.