Click to See Complete Forum and Search --> : Scrolling Forms


Girish Chandra
September 27th, 1999, 08:12 AM
Hi Everybody,

I am working on a project using MDI. In MDI it is necessary to have child forms (MDI Clients) with scrollbars so that any resizing done by the user does not make some portions of the form inaccessible.

I tried to find out some way out but could not find any property which would allow me to put scrollbars on the form. Only MDIFrame supports Scrollbars property, but what about MDIChildren? I worked out a solution by putting a Frame, HScrollbar and VScrollbar controls on the form and associated code to scroll the frame as per the scrollbar positions. The actual controls were placed on the Frame control. This approach to my problem requires me to repeat this in each form I create.

Is there another way to resolve my problem (There must be). Please help me out. I am sure other VB developers must have confronted similar situations in MDI system.

Thanks everybody
Girish Chandra

Chris Eastwood
September 27th, 1999, 02:32 PM
I'm afraid that it's an all to common problem / short coming of VB that this happens. However, vbAccelerator have a class/control that allows you to add scrollbars to just about any container control.

Look for it at http://vbaccelerator.com

Chris Eastwood

CodeGuru - the website for developers
http://codeguru.developer.com/vb

September 29th, 1999, 02:39 PM
Couldn't you create a template of a blank form with the scroll bars and associated code?

Freddie
November 29th, 1999, 06:26 PM
I have a similar problem which I posted today. Here it is:
I have a long form contained within a picture box. I am using both horizontal and vertical scroll bars.
I would like to have my application automatically scroll when the cursor has
reached the edge of the screen. This would make it more practical from a
users standpoint. Currently, when the cursor reaches the edge of the screen,
the user has to manually slide the scroll bar.

If you have solved your problem, mine seems very similar. Do you have any suggestions?

Ravi Kiran
November 30th, 1999, 12:03 AM
You can catch the GotFocus event on the controls and determine if that control is visible or not based on current Scrollbar position/value. THen you can set the scoll value such that the control is visible.

You might write a generic "OnFocus" routine which will take the focus control as input and automatically does this thing. Then add a single line of code in all control's GotFocus events to invoke this function with appropriate param.

I dont how you are implementing it. I would assign the scaleWidth/height value of the Form to the scrollbars values. So that when i set vScroll.value = Command1.top, it should automatically show the control command1

RK