wxBufferedPaintDCThis 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 make sure wxWindow::SetBackgroundStyle is called with wxBG_STYLE_CUSTOM somewhere in the class initialization code, 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. Derived from
wxBufferedDC Include files <wx/dcbuffer.h> See also wxDC, wxBufferedDC, wxAutoBufferedPaintDC Members
wxBufferedPaintDC::wxBufferedPaintDC
wxBufferedPaintDC::wxBufferedPaintDCwxBufferedPaintDC(wxWindow *window, wxBitmap& buffer, int style = wxBUFFER_CLIENT_AREA) wxBufferedPaintDC(wxWindow *window, int style = wxBUFFER_CLIENT_AREA) 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).
wxBufferedPaintDC::~wxBufferedPaintDCCopies everything drawn on the DC so far to the window associated with this object, using a wxPaintDC.
|