If I understand the documentation correctly, changing from wxPaintDC to wxAutoBufferedPaintDC should only yield in added buffered drawing, all other dc functions remain the same.
wxBufferedPaintDC is a buffered version of wxPaintDC . Simply replace wxPaintDC with wxBufferedPaintDC
in your paint event handler, and the graph-ics will be drawn to a bitmap before being drawn all at once on the window,
reducing flicker (Cross_Platform GUI Programming with wxWidgets, J. Smart, p. 136.)
I have a paint handler that does some drawing using axis orientation in default mode Y top to bottom and another part that uses Y bottom to top. Extract below:
Code: Select all
void MyFrame::OnPaint (wxPaintEvent &e)
// wxAutoBufferedPaintDC dc(this);
wxSize sz = GetClientSize();
int d = 10; // offset from side for drawing rect
// change orientation of axis to normal math X-Y quadrant 1
// dc.SetAxisOrientation(true,false); // only needed using wxAutoBufferedPaintDC
With wxPaint there is no issue: the Y-axis orientation is stateless, if I do not restore the Y top to bottom orientation at the end of my paint handler, all is ok and the default orientation is available in the next paint cycle.
With wxAutoBufferedPaintDC the Y-axis orientation at the end of the paint handler seems to be memorized: if I do not restore the state at the end of the paint handler, the Y bottom to top orientation is kept in the next paint cycle and my drawing is not what it should be (drawing is messed up completely after resizing the window).
To me this might point in the direction of a bug, but since I am very new with wxWidgets, I might oversee something?
(Using VC2008 Professional on Windows 7. wxWidgets 3.0.4.)