Solved

Creating Scrollable MDI Child Forms

Posted on 2000-02-29
7
224 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
Comment Utility
0
 
LVL 3

Expert Comment

by:paulstamp
Comment Utility
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
Comment Utility
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 10 total points
Comment Utility
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
Comment Utility
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]
Comment Utility
Need your email
0
 

Author Comment

by:lsmith2574
Comment Utility
My email is lsmith7@hotmail.com.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

744 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

17 Experts available now in Live!

Get 1:1 Help Now