Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding scrollbars to PictureBox Control

Status
Not open for further replies.

dsk525

Programmer
Mar 13, 2002
73
US
Hi

I have like 12 pictures(JPG Format). The pictures are big so i need scrollbars to view them. I can not make them small are they specify some readings. I tried using flexgrid to display the images. But it came out to be not that convinient. I had to set the colwidth and row height. If i did that i did not get scrollbars.

So I thought of seeing my luck with picture box. I have a scrollbar. According to the scrollbar value i load the picture to the picturebox. This works.. but i have a problem. The size of the pictures is bigger than picturebox control i have. so i need scroolbars so i could scrool throught the whole image ... is there any way i could do that ...

If you have any other better ideas please feel free to mail me

Satish Pasala
psathishreddy@hotmail.com
 

Satish,

Please see our FAQ section why it is not a good idea to have your email address where everyone in the world could copy it and sell it or use it to send you junk mail. Then again the answers that may be provided to you via your email will not help others who use this forum and may have a similar question.

Now for a simple suggestion. Set the border property of your picture box to none and place it in a frame. Then on the outside of the frame you could place your scrollbars. When you load the (new) picture make sure that the picturebox left and top are set to 0 along with two scrollbar values. Set the picture box autosize property to true so that it expands to the size of the picture that you load. You will need to do some calculations to set the max value of the scrollbars, but it should not be too hard. Now when the user uses one of the scroll bars all you need to do is set the left or top to a negative number based upon the scrollbars value.

[tt]
Pic1.Top = (0 - VertScroll1.Value)
[/tt]

or something like that.

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top