This is a subclass of wxBufferedDC which can be used inside of an OnPaint() event handler. Just create an object of this class instead of wxPaintDC and that's all you have to do to (mostly) avoid flicker. The only thing to watch out for is that if you are using this class together with wxScrolledWindow, you probably do not want to call PrepareDC on it as it already does this internally for the real underlying wxPaintDC.
As with wxBufferedDC, you may either provide the bitmap to be used for buffering or let this object create one internally (in the latter case, the size of the client part of the window is used).
Pass wxBUFFER_CLIENT_AREA for the style parameter to indicate that just the client area of the window is buffered, or wxBUFFER_VIRTUAL_AREA to indicate that the buffer bitmap covers the virtual area (in which case PrepareDC is automatically called for the actual window device context).
Copies everything drawn on the DC so far to the window associated with this object, using a wxPaintDC.