Solved

Creating Scrollable MDI Child Forms

Posted on 2000-02-29
7
225 Views
Last Modified: 2013-12-26
I am creating a Visual Basic 6 MDI application that is made up of numerous MDI child forms.  I would like for the child forms to have a vertical scroll bar that allows the user to scroll to view hard to see data.  I looked at the answer to question 10050026 from clsmaster and tried the code and it didn't work for me.  My vertical scroll bar kept shrinking to the top of my form.  In clsmaster's response there are several things that are unclear.  For instance, when he/she says set the tag property of the control to the top property on the control which control is he referring to?  Set the scroll bar control's tag property to the top property of the scroll bar or the form?  Also, there's no such thing as on local error resume next.  If someone could provide me with code that will allow me to add vertical and horizontal scroll bars to mdi child forms within a mdi environment to produce scrolling that is similiar to Microsoft Word, I would greatly appreciately.
0
Comment
Question by:lsmith2574
7 Comments
 
LVL 9

Expert Comment

by:Ruchi
ID: 2571545
0
 
LVL 3

Expert Comment

by:paulstamp
ID: 2572125
Ruchi... I dont see how that link helps - are you sure you got the URL right ?

To create scrollable forms I use the following technique :

Create a picture box to be the viewable area and call it picFrame and set it to the appropriate size (perhaps to cover the entire form). Then create another control inside this which will be the actual document itself (for this example I use a picture box called picCanvas).Set picCanvas's width and height properties to the actual size you want (not the visible area).

Add a vertical scrollbar and a horizontal scrollbar again into picFrame (not picCanvas). Then set the top and left properties of picCanvas to 0.

In picFrame_Resize event :

scrVertical.Left = picFrame.ScaleWidth - scrVertical.Width
    scrVertical.Height = picFrame.ScaleHeight - scrHorizontal.Height
    scrVertical.Max = picCanvas.Height - picFrame.ScaleHeight
   
    scrHorizontal.Width = picFrame.ScaleWidth - scrHorizontal.Left - scrVertical.Width
    scrHorizontal.Top = picFrame.ScaleHeight - scrHorizontal.Height
    scrHorizontal.Max = picCanvas.Width - picFrame.Width

Then in the vertical scrollbar Change event :

    picCanvas.Top = -scrVertical.Value
    picCanvas.SetFocus

And in the horizontal scrollbar :
    picCanvas.left= -scrHorizontal.Value
    picCanvas.SetFocus

Now when you move the scrollbars the viewable portion of picCanvas is panned. Not that a picture box can contain other controls, so picCanvas could have text boxes, labels etc placed on it.

Hope this helps.
0
 
LVL 3

Expert Comment

by:jjmartin
ID: 2576941
Goto http://www.planet-source-code.com and check out the VB section.  In the VB section do a search on ScrollingForm.  You should find a custom control I posted there that might meet your needs.  The custom control allows you to automatically scroll objects on the form (that are placed within the control), and allows you to scroll during design time to place controls.  Hope this helps.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 10 total points
ID: 2609814
I implemented a small OCX that you can use to implement a scrollable area.
If you want to get it (including vb source code of course)
let me know
0
 

Author Comment

by:lsmith2574
ID: 2609857
AngelIII,
I would like to see the OCX that you have.  Just let me know where I can retrieve it from or what information you need from me.
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 2609867
Need your email
0
 

Author Comment

by:lsmith2574
ID: 2613530
My email is lsmith7@hotmail.com.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now