Re: Horizontal ScrollBar+ PictureBox + Flickering (how to stop flickering?)



"Frank Moyles" <fgmoyles@xxxxxxxxxx> wrote in message news:wMydncOyocwrHvfaRVnyhAA@xxxxxxxxx

I have a PictureBox placed on a form, as well as a horizontal
scroll bar. I am drawing a graph (output from an instrument)
on the PictureBox. I am 'scrolling' the graph by dragging the
horizontal scroll bar. Each time the scroll bar changes, I am
getting the new values and using that event to redraw the
graph - it works in theory, but in practise, it flickers quite a lot.

Try drawing into a backbuffer first. One very easy way of doing this is to simply set the Autoredraw property of the PictureBox to True, which will eliminate the flicker. You might also like to try speeding up the drawing of your graph lines using the PolyLine API instead of drawing the individual lines one by one (if that is what you are currently doing).

Mike


.



Relevant Pages

  • Re: Which component to use to display mathematical graphs with VB6
    ... Your code can then draw into that Form's client area (the area ... inside its borders) or alternatively into a PictureBox that you can ... generally very fast at drawing a set of many lines in one call using a ... Do you mean you want your graph to cover all of the available screen ...
    (comp.lang.basic.visual.misc)
  • Re: Horizontal ScrollBar+ PictureBox + Flickering (how to stop flickering?)
    ... I am drawing a graph ... horizontal scroll bar. ... Try drawing into a backbuffer first. ... One very easy way of doing this is to simply set the Autoredraw property of the PictureBox to True, ...
    (microsoft.public.vb.general.discussion)
  • Redrawing a part of a control
    ... I am drawing some lines on a picturebox control. ... graph based on some changing variables in memory. ... Invalidate method of the picturebox to redraw the lines. ...
    (microsoft.public.dotnet.languages.vb)
  • Horizontal ScrollBar+ PictureBox + Flickering (how to stop flickering?)
    ... I have a PictureBox placed on a form, as well as a horizontal scroll bar. ... I am drawing a graph on the PictureBox. ...
    (microsoft.public.vb.general.discussion)
  • Re: Horizontal ScrollBar+ PictureBox + Flickering (how to stop flickering?)
    ... 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 is usually very fast. ...
    (microsoft.public.vb.general.discussion)