You probably misunderstand Auto-scroll.
Here is the explanation:
http://www.bobpowell.net/understanding_autoscroll.htm[
^].
First, in case you hope Auto-scroll takes into account the bounding size of your rendered graphics: it won't. The panel will clip it exactly in the same way as without Auto-scroll; you reasoning "The circle's rectangle size is (800, 800)".
Then,
AutoScrollMinSize
should be more than
Panel.Size
. For example, if it is twice big as in Width and Height, it behaves like you have a 4-fold "virtual" paint area then the area you can see at once, at fixed scroll position.
Finally, Auto-scroll is designed to scroll children on your panel, not your rendered graphics. When you implement what you want, your graphics will be messed up when you scroll, because scroll does not invalidate you panel. If your handle the event
Scroll.Scroll
(as you should), you graphic... will not be moved with scroll, it be staying in the same place. To work around, you could move your rendering data as well, which in not effective. Look by yourself:
panel1.Width = 100;
panel1.Height = 100;
panel1.AutoScroll = true;
panel1.AutoScrollMinSize = new Size(200, 200);
panel1.Paint += (sender, ev) => {
ev.Graphics.FillEllipse(Brushes.Red, new Rectangle(10, 10, 20, 40));
};
panel1.Scroll += (sender, ev) => {
};
This is not how such problem should be solved. Again, Auto-scroll is designed to scroll children on your panel, so you need put a child panel of bigger size than you parent panel. Then you should do you graphic rendering on bigger child panel but scroll a smaller parent panel. I did, it worked.
—SA