add scrollbar to picturebox

how we can add scrollbar(v & h) to a picturebox
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

this does exactly what you want

you can download the file and build of it

hope this helps

vfathiAuthor Commented:

Dear sir,

i couldn't receive that  .ocx file and
that picturebox didn't have any scroll.
why and what i should do?

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

vfathiAuthor Commented:

Dear sir,

thanks for your answer but it could not help me.
i want to make a picturebox and some textbox into
it, when i make another textbox into a picturebox
it take scroll Automatic like when we add files into
a menu, it make scroll Auto.
hope you notice my mean and help.

thank you
wait for your reply soon
Use a PictureClip Control. Place a scrollbar against a PictureBox, and in its Change Events Move the PictureClip, and refresh the PictureBox with the Clip as image.
vfathiAuthor Commented:

please tell me how i can make this:
i want make a picturebox and some(example:3) textbox into it that when type into textboxes(in 3th), if it is another data for textbox, when i click enter,it make automatically add textbox(like number 4), into picturebox and
i can type into 4th textbox and ...

can you help me, please.
you should make a control array of textboxes. whenever you need another textbox, load a new one, like:

load TextBoxArray(4)

You can set the coordinates of the new textbox before showing.
vfathi, when a proposed answer doesn't fulfil your requirements, you should probably reject the answer to put your question out of the "Locked Questions" area.

Friendly Neighbourhood Community Support Moderator

The best solution I've found for making a scrollable picturebox is to embed it inside another picturebox and include a vertical and horizontal scrollbar to handle the movements.

It's not a trivial task to code it, but the simple way is to simply size the inner picturebox (Picture2) to the outer picturebox (Picture1) less the scrollbar sizes:

' ensure that picture1 is inside picture2--usually done at design-time rather than here.
Set Picture2.container = Picture1

Picture2.Borderstyle=0 ' no border

' resize picture2
Picture2.move 0,0,picture1.scalewidth - VScroll1.width, picture1.scaleheight - HScroll1.height

' move scrollbars to the right/bottom
VScroll1.move Picture2.width,0, VScroll1.width, Picture2.height
HScroll1.move 0,Picture2.height, Picture2.width

Then, when the scroll bars are scrolled, move the picture up/down or left/right
vfathiAuthor Commented:

Dear sir,

this is my questions?

1) in VB, now on a picturebox or by rich textbox or another,
i need two columns, one of them for counting and the other
for typing, like this.
|                              |
|  |-----textbox------|  |-1-| |
|  |------------------|  |---| |
|                              |
|  |------------------|  |-2-| |
|  |------------------|  |---| |
|                              |
|  |------------------|  |-3-| |
|  |------------------|  |---| |
|                  counterbox  |

after typing the last word by the user on the first textbox,
and pushing Enter key, cursor must go to the second textbox
of course by paying attention that when the cursor is on the
second textbox, the counterbox put the number there,
automatically. i mean when i'm in the second textbox, the
counter put 2 number automatically, and...

2) now, please consider we have 3 textbox and 3 counterbox.
now if a user want to use the fourth textbox, the program
must be able to run it for user, automatically.

3) but about scroll length:
as we had considered just 3 counterbox and textbox, so
we have no scroll here at all.
but after increasing boxes the program must be able to
create vertical scroll, of course automatically.

if the characters typed by user are more than our textbox
length, so we will need a horizontal scroll here, too.

can you help me, please?
it will be very kind of you to advice me, if it's possible.
thanks for your time and attention.


vfathiAuthor Commented:

like this:

|  |----textbox---|   |-1-| |
|  |--------------|   |---| |
|                           |
|  |--------------|   |-2-| |
|  |--------------|   |---| |
|                           |
|  |--------------|   |-3-| |
|  |--------------|   |---| |
|             counterbox    |  

Interestingly enough, this is almost identical to the examples in the book "Teach Yourself ActiveX Controls in Visual Basic 5.0 in 21 Days".  Look for this book in the bookstore.  It may be in the discount section since it's VB5, but its information is still current!
vfathiAuthor Commented:

Dear sir,

sorry, i couldn't find it.
please tell me how i must write my program
for solve my questions?


Create a user-control which has the textboxes and various properties and methods to handle the settings.  Add features to handle the counting based on a property (PerformSum) which will query the parent container for all components of that type and display a total.

It's 21 chapters, so summarizing in one paragraph is tough.

The scroll feature will have to be added separately, probably through a scroll component and a picturebox.  Then place each combocomponent into the picturebox and the scrollbar outside on the right.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rejecting proposed answer.

Force accepting rspahiz' comment unless someone objects in the next 4 days.

Community Support Moderator @ Experts-Exchange
Points to rspahitz as suggested by costello.

community support moderator
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.