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.
|