Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can one scroll legitimately with GDI+?
    text
    copied!<p>Is there a preferred, fast method of scrolling within a user control in GDI+?</p> <p>I've created a control that graphically renders a horizontally scrollable data plot.</p> <p>Currently, my control operates by converting the position of a horizontal scroll bar into an offset into the data. The control then renders the data that exists between this starting point and an end point calculated based on the width of the control.</p> <p>This method works, but is very slow. I do not wish to have to manually redraw the entire control surface upon each scroll event. Rather, I'd like to initialize the control by painting the entirety (or some portion) of the graphical data to an offscreen surface, and then virtually scroll the control surface by causing it to read the pre-rendered graphic data starting at the offset calculated by the position of the horizontal scroll bar.</p> <p>Is BitBlt the only way to do this? Do I really have to manually copy graphics data from one surface to another? Can't I just take over the Paint event and cause it to read the data from the offscreen surface as it renders? This way, the copy and render action are one in the same. </p> <p>Or, should I do something hokey like paint directly to a Panel control and then just literally scroll the panel itself from left to right? </p> <p><strong>CLARIFICATION</strong>: Essentially, I want to know the correct way to scroll pre-rendered data. How does one scroll graphical data within a control? Redrawing the <em>pre-rendered</em> graphic is NOT a correct option.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload