How can I scroll legally with GDI +?

Is there a preferred quick way to scroll in a user control in GDI +?

I created a control that graphically displays a horizontal scrollable graph of data.

My control currently works by converting the position of the horizontal scrollbar into an offset into data. The control then displays the data that exists between this start point and the end point, calculated based on the width of the control.

This method works, but very slow. I do not want to manually redraw the entire control surface with every scroll event. Rather, I would like to initialize the control by painting all (or part) of the graphic data on the external surface, and then actually scrolling the control surface, forcing it to read the previously rendered graphic data, starting from the offset, it is calculated along the horizontal scroll bar.

Is BitBlt the only way to do this? Do I need to manually copy graphic data from one surface to another? Can't I just take the Paint event and make it read data from the mirror as I render it? Thus, the copy and render action is one and the same.

Or, should I do something hokey, like paint, right on the control panel, and then just literally scroll the panel directly from left to right?

EXPLANATION : Essentially, I want to know the correct way to scroll through pre-processed data. How to scroll graphic data in a control? Redrawing pre-processed graphics is NOT a valid option.

+5
source share
1 answer

Yes, I would try double buffering. If you are drawing a bitmap off-screen, you can simply scroll around the bitmap.

. , , , , , , .

32- Windows XP , 237,9 . , , , .

, Windows, :

Width   Height    Area (pixels)
======   ======    ===========
32,767    7,261 237,921,187
25,000    9,517 237,925,000
23,792   10,000 237,920,000
20,000   11,896 237,920,000
15,861   15,000 237,915,000
15,000   15,861 237,915,000
11,896   20,000 237,920,000
10,000   23,792 237,920,000
 9,517   25,000 237,925,000
 7,261   32,767 237,921,187
+3

All Articles