I've been working on a double buffered canvas in a scrolled window. After
reading Chris Barker's Wiki on the subject I modified my own code to use
his ideas. I haven't been able to do it completely so I'm now modify
Chris's code to use a scrolled window and hopefully I'm solve my problems
by solving those problems. There are two problems thus far.
1. The scrolled are is larger than the drawn area and I'm not sure what is
wrong.
2. If you move the view port and redraw the canvas the automatic PrepareDC
that is supposed to be in the BufferedDC doesn't draw the canvas in the
corrrect place. Scrolling back to the origin shows this.
--
Nigel W. Moriarty
Building 4R0230
Physical Biosciences Division
Lawrence Berkeley National Laboratory
Berkeley, CA 94720-8235
Phone : 510-486-5709
Fax : 510-486-5909
Email : NWMoriarty@LBL.gov
Web : CCI.LBL.gov
I've been working on a double buffered canvas in a scrolled window. After
reading Chris Barker's Wiki on the subject I modified my own code to use
his ideas. I haven't been able to do it completely so I'm now modify
Chris's code to use a scrolled window and hopefully I'm solve my problems
by solving those problems. There are two problems thus far.
1. The scrolled are is larger than the drawn area and I'm not sure what is
wrong.
I'm not sure. It looks right. There must be something simple that we are missing...
2. If you move the view port and redraw the canvas the automatic PrepareDC
that is supposed to be in the BufferedDC doesn't draw the canvas in the
corrrect place. Scrolling back to the origin shows this.
In UpdateDrawing you need to call self.PrepareDC on the ClientDC:
cdc = wxClientDC(self)
self.PrepareDC(cdc)
dc = wxBufferedDC(cdc, self._Buffer)
self.Draw(dc)
BTW, if you are not changing the virtual size there is no reason to make a new buffer in OnSize.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!