Re: Horizontal ScrollBar+ PictureBox + Flickering (how to stop flickering?)
- From: "Mike Williams" <mikea@xxxxxxxxxxxxxxxxx>
- Date: Fri, 21 Dec 2007 15:39:09 -0000
"Steve Gerrard" <mynamehere@xxxxxxxxxxx> wrote in message news:S6KdnQoNi-jatvbanZ2dnUVZ_g6dnZ2d@xxxxxxxxxxxxxx
Is there a way OP could BitBlt most of the existing graph to
the left or right, and then draw in the new section? This seems
to be a common method in MS Word and such for updating
the display without redrawing everything.
Yes, there is. Thanks for pointing that out. When the user moves the scroll bar you just need to compare the start and end points of the "already drawn" data and compare it to the new required start and end points and blit the appropriate "already drawn" part into its new position and then clear the rest of the graph and draw the new data points. The total amount of blitting is the same of course, because with either method you need to blit the full width of the graph, but the number of lines you need to draw is less because you are drawing only the newly required lines. Personally when drawing graphs consiting of single pixel thickness lines I usually I opt for the simplicity of clearing the entire graph and drawing the entire new set of data on the grounds that drawing single pixel thickness lines (especially if you use PolyLine) is usually very fast. Your suggested method is definitely the way I would do it though if the lines were greater than a single pixel thick (because drawing such lines is much slower) or if the graph contained various filled areas or other more complex elements. That's why things like Microsoft Word use such a method, because the stuff that is drawn to the page is often quite complex and in such cases it is very much faster to use the method you have suggested. In both cases of course you really need to be composing the drawing into a backbuffer and then transferring the completed drawing to the display in one go, to avoid flicker. Naturally in some cases (where the entire graph is not too large and is reasonably static) you can even use the very simple method of drawing the entire graph into memory and simple display the appropriate part of it using a single blit. There are all sorts of different methods.
Mike
.
- References:
- Horizontal ScrollBar+ PictureBox + Flickering (how to stop flickering?)
- From: Frank Moyles
- Re: Horizontal ScrollBar+ PictureBox + Flickering (how to stop flickering?)
- From: Larry Serflaten
- Re: Horizontal ScrollBar+ PictureBox + Flickering (how to stop flickering?)
- From: Mike Williams
- Re: Horizontal ScrollBar+ PictureBox + Flickering (how to stop flickering?)
- From: Steve Gerrard
- Horizontal ScrollBar+ PictureBox + Flickering (how to stop flickering?)
- Prev by Date: Re: How many apps fail after installation?
- Next by Date: Word template handling
- Previous by thread: Re: Horizontal ScrollBar+ PictureBox + Flickering (how to stop flickering?)
- Next by thread: Checkbox graphical style: what oddity it is?
- Index(es):
Relevant Pages
|