Picturebox ScrollBars

R

Ruben Sanchez

Hi, does somebody know how to use scrollbars with a
picturebox in C# ?, the compact framework does not have
an event scroll .

Thanks
 
B

Boris Nienke

Hi, does somebody know how to use scrollbars with a
picturebox in C# ?, the compact framework does not have
an event scroll .

you mean to scroll a bigger bitmap?

Do it by yourself using the hScrollbar and vScrollbar.

Idea:
- put a panel on your form
- put a picturebox on that panel
- load the bitmap or whatever into the picturebox and make it as big as
the entire bitmap

- put two scrollbars (horizontal, vertical) on the form
- in the LoadForm-Event set the "minimum" to 0 and the "maximum" to
"pictureBox.height - panel.height" (and similar with "Width" for the
hScrollBox)
- in the "ValueChanged"-Event of the scrollbars just move the picturebox
on the panel by setting the ".top" and ".left" values to (for example)
"pictureBox.Top = -vScrollBar.Value"

Boris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top