Hello,
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);
}
Problem:
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!!!