Solved

Creating Scrollable MDI Child Forms

Posted on 2000-02-29
7
226 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

776 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