470,641 Members | 1,575 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,641 developers. It's quick & easy.

How to stop an autoscroll event on a panel?

I have a problem with getting an autoscrollbar to end up where I want it.
Things to know about the prob:
I have an imagebox inside of a Panel for (inheritance of) autoscroll capabilities. The imagebox is named panel2 for my own conventions and the panel will be named panel1
Panel2 (the imagebox) is set to fit to the size of Panel1 (the Panel). All of this works great...
I have broken up an extremely large image (width wise, not mem size) that is to large for autoscroll to handle which caused my prog to crash.
The original image (the really big one)will be called bmp_temp.
Each of these smaller image pieces I will call testimage0, testimage1, etc. and will save them to myBmp.
I have set the following:
panel1.AutoScrollMargin = bmp_temp.Size;
panel2.Image = myBmp;
Also assume that panel1.autoscroll = true;

//If I reach the end of the first image...
if (-x_scroll_val >= (this.panel2.Image.Width))

// Load the next image.
Bitmap myBmp = new Bitmap(@"c:\Docume..... //yes this retrieves the next image (testimage1) just fine.
panel2.Image = myBmp;

//somewhere here is the problem????????
this.panel1.AutoScrollOffset = new Point(-myBmp.Width, 0);
this.panel1.AutoScrollPosition = new Point(myBmp.Width , 0);
this.panel2.Location = new Point(0, 0);

When I reach a certain point on the first image (testimage0, which you can assume was preloaded and autoscroll works just fine on it), I want to be able to load the next image (for example testimage1) and have the autoscroll be at the same place I left off at. I assumed this has something to do with autoscrolloffset but whenever I use this small lump of code, the new image is placed in the proper place and the autoscroll is in the correct position but it will not allow me to scroll the new image. Do you have any ideas on this?

So... I also have now tried ScrollControlIntoView which brings the autoscroll bar position back to zero... Again I want it to be at where the last image had ended (therefore) at the beginning of the second image. The rest of my program (an event analyzer) is dependent on these autoscroll positions. I can not use regular scrollbars.

Any Ideas Would be awesome!!!
Oct 11 '06 #1
0 2679

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

12 posts views Thread by NewSun | last post: by
2 posts views Thread by Martyn Fewtrell | last post: by
1 post views Thread by Chris Morse | last post: by
reply views Thread by 23s | last post: by
5 posts views Thread by Frank | last post: by
3 posts views Thread by Tom Bianchi | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.