Link to home
Start Free TrialLog in
Avatar of modijs
modijs

asked on

scrollbar in vb

how to implement a scrollbar in vb form.
my form is mdi child type. my problem is such that i have a picture box in a mdi child form. the size of picture box changes during run time, so the need of scrollbar is there if the picture box size is greater than mdi child form. how to do this so that by scrolling i can completely see the picture
reply  if possible with a sourcecode
this scrolling you may call form level scrolling.
in vc and java it is automatically implemented but in vb it is not
Avatar of sudhi022299
sudhi022299

I don't know whether MDI child forms have this feature. But you can do one thing
When the picture box changes it size, you can trap the RESIZE event of it and explicitly resize your form.

By this way you can always have your child form showing the picture box. In case the child form grows bigger, then the MDI Form will automatically get scrollbars as it "scrollbar" property is true by default.

My 2c worth  :-)

Regards,
Sudhi.
You place a frame on your form and then place the picture box on that. Even though the picture box's size changes, it will be placed in the frame, so, the size of the frame does not change. Now, you change the scroll bars' properties like min, max dynamically. Then when user scrolls, in the scroll and change events, change the position i.e, left, top properties of the picture box. This should work. Any questions, please feel free to contact.
Avatar of Éric Moreau
I can send you a sample project that does not uses a picture box but 2 scroll bars instead.

Give me your e-mail address if interested.
Avatar of modijs

ASKER

i want it as a type of perfect window application using  frame is not an appropriate.  i have to make an application in which i have to draw plan.  it is just like auto cad application.  so in this my area changes dyanmically so what should be done to draw this on the client area of form where the size can be greater than form.  i have used picture box in the form for drawing.  but while changing size of picture box as the needed or size of picture box should be increased when zoom is implemented it does not come within the form client area, scroll bars can help to scroll the area.
Forms other than MDI Forms cannot by default have scroll bars.
For any other forms you will have to prgram it putting a vertical scroll bar on ur form.
Preferably put the picture box in a frame control. then in the change event of the vertical scroll bar manipulate the top of the frame(if u dont want to use the frame u will have to manipulate the tops of all the controls on the form other than scroll bar) to give a scrolling effect.

Regds
I just found source code for an ActiveX control that implements automatic scroll bars on forms.

I can send it to you be e-mail by I need your address!
Avatar of modijs

ASKER

i have found that scrollbar can be implemented using api's function like showscrollbar etc. send me the source code for implementing using this.
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

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 modijs

ASKER

thanks for ur support.