Link to home
Start Free TrialLog in
Avatar of marounk
marounk

asked on

Picture Box scrollbars

Hello

I have a Windows form that I am displaying a bitmap within inside a picturebox, now this bitmap has some drawing I made , rectangles and text drawings, everything is ok.

but when this bitmap is large ( I mean too many drawing inside it) it does not fit inside the page so i need the user to scroll down to see more , I added a vscrollbar but what I do not know how to do is : how can I make it work , how can I make the image move down and up when the user clicks on the scrollbar

the image is contained inside a picturebox , the picturebox is made to fit the whole windows form which is an MDI Child.

any ideas ?
ASKER CERTIFIED SOLUTION
Avatar of NTAC
NTAC

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bob Learned
You might also want to think about a scrollable Panel control.

Bob
Avatar of _TAD_
_TAD_


*NOT FOR POINTS*

I'd follow Bob's suggestion.

put a panel on your form and size it the way you want.

Then dynamically add a picturebox to that panel that contains your picture




<button click event>
         PictureBox p;
         panel2.AutoScroll = true;

         // new picturebox
         p = new PictureBox();

         // set picture
         p.Image = Image.FromFile(@"C:\temp\test.jpg");

         // set size and location of picturebox
         p.Location = new Point(10,10);
         p.Size = new Size(p.Image.Width,p.Image.Height);

         // add picturebox to scrolling panel
         panel2.Controls.Add(p);