Solved

See all form, if 640X480 or 800X600.

Posted on 1998-12-23
9
148 Views
Last Modified: 2010-05-03
How does one insure that the whole form is shown on every monitor, no matter what the desktop area pixels is set at?
0
Comment
Question by:RUSTY
9 Comments
 

Expert Comment

by:jmnolan
ID: 1452216
RUSTY-

One way you might want to try is to maximize the form. You can do this by:

Me.WindowState = vbMaximized

Then you could also grab the Height and Width Properties...

or if you are talking about resizing all of the controls on the form you either have to write custom code (Where you could use the height and width properties of the maximized form), or you can purchase a resizing control from a third-party vendor.

Hope that helps.

-joe
0
 
LVL 3

Expert Comment

by:vbWhiz
ID: 1452217
You set your desktop to be at a 640x480 resolution and select the large fonts option.

I personally think 640x480 is a bit small to try to cater to all the time. Many applications I have worked on have had 800x600 as the minimum.
0
 

Author Comment

by:RUSTY
ID: 1452218
The deal is that it is written such that it fits nicely on a display set at 800X600.  We have a workstation here that only works at 640X480, and that individual cannot see the whole of one of the forms, the right part and bottom is cut off and cannot be accessed.
Directions to a third party conrol, or (preferably)code samples to make it shrink (with all controls set on it visible too) to fit this persons monitor will win points.  

0
 
LVL 15

Expert Comment

by:ameba
ID: 1452219
The only cure I see is redesign of forms:
- add tabstrip control to have more then one 'page'
- replace group of controls with "Details" button which opens new form
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 3

Expert Comment

by:Sendoh
ID: 1452220
Hi !
Yeap I agree with ameba.
For this scenario, you best solution is redesign your form and the time you code, better cater for resting the control and form size based on resolution.

^_^
0
 
LVL 1

Expert Comment

by:hddp666
ID: 1452221
Get the monitor resolution from the Windows registry, and then resize the forms to match.

You might also try something like this:

Private Sub Form_Resize()
     Form1.Width = 0.9 * Screen.Width
     Form1.Height = 0.9 * Screen.Height
End Sub

All of the stuff on the form should also change proportionally. In effect, the screen size is a parameter that determines the size and location of everything on the form.


Or just fix the forms to look OK at 640x400 resolution, and have extra spacing around the edges at 800x600. The user can manually resize the form, if necessary.
0
 
LVL 2

Expert Comment

by:trillo
ID: 1452222
No matter what you're planning, the best way is ALWAYS to program for 640x480 monitor resolution... this ensures that it will be seen fine in any resolution.
Since there are 19" monitors with more than 1600 pixels on one direction, you shouldnt schrink or expand your forms.. People buy huge monitors in order to see more windows, not to see bigger windows... You're programm won't look fine on a huge monitor, that is sure, it'll look like a programm for babies with huge buttons and other controls... It's not standard either.

Trillo
0
 
LVL 1

Expert Comment

by:muffinthedog
ID: 1452223
Rusty...
    know it's a kludge but can't just do something on the load like

If GetSystemMetrics(SM_CXSCREEN) = 640 Then
    For Each Control In Controls
        Control.Top = Control.Top * 0.8
        Control.Left = Control.Left * 0.8
        Control.Width = Control.Width * 0.8
        Control.Height = Control.Height * 0.8
    Next
End If

0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 50 total points
ID: 1452224
You can always put scrollbars on the form if the form becomes to small.

I have perfected scrolling forms and here is my solution:
1. Place a picture box on your form.  Now place a second picture box contained within the first and a vertical scroll bar on the form.
2. Place all of your controls onto the second picture box.
3. When runnning the application picture box1 must have its height property below picture box2 in order for scroll bars to appear:  The code is below:

Private Sub Form_Resize()
' **************************************************
' * Author: David Carty
' * The forms height, width, scrollbar height etc.
' * must be resized according to the screen
' * resolution.  This mechanism is implemented
' * within this event.
' **************************************************

' picscroller is the picturebox 1 in the instructions

    picScroller.BorderStyle = 0
    picContainer.BorderStyle = 0

    m_strCurrentProcedure = "VScroll_Change"
    
    picScroller.Height = frmMenu.FormHeights - 1000
    picScroller.Width = Me.Width - VScroll.Width - 100
           
    picContainer.Height = 5600 'This controls the size of the container
    picContainer.Width = Me.Width - 60
       
    VScroll.Top = 0
    VScroll.Left = picScroller.Width + 50
    VScroll.Height = picScroller.Height
       
    VScroll.Max = picContainer.Height - picScroller.Height
    VScroll.Visible = picScroller.Height < picContainer.Height
   
End Sub

Private Sub VScroll_Change()
' **************************************************
' * Make the form appear to scroll relative to the
' * scrollbar.
' **************************************************

    m_strCurrentProcedure = "VScroll_Change"
    picContainer.Top = -VScroll.Value
    
End Sub

or take a look at
How to Scroll a Form When VB Forms Are Limited to Screen Size
Last reviewed: July 19, 1996
Article ID: Q109741
The information in this article applies to:
 &#61623; Professional and Enterprise Editions of Microsoft Visual Basic, 16-bit only, for Windows, version 4.0
 &#61623; Standard and Professional Editions of Microsoft Visual Basic for Windows, version 3.0
SUMMARY
A Visual Basic form cannot be sized larger than the screen. This article explains how to scroll the contents of a form to enlarge the usable area of a form.
The sample program below works by scrolling a picture box control which is larger than the form and contains attached controls. When the picture box scrolls, all the attached controls scroll together.
MORE INFORMATION
Step-by-Step Example
NOTE: This technique will not work on any version of Windows NT if any of the Visual Basic lightweight controls (for example, Label Control) are children of the scrolling control and positioned outside of the screen's viewing area. This is due to the way that Windows NT handles drawing to nonlogical areas of the screen. To work around the problem, do not use lightweight controls as children of the scrolling control.
1. Start a new project in Visual Basic. Form1 is created by default.
2. Add a horizontal scroll bar control and a vertical scroll bar control to Form1. (The size doesn't matter because the program automatically sizes the scroll bars in the Form Resize event code.)
3. Add a picture box control to Form1. Draw a text box control inside the upper-left corner of the picture box such that when the picture box moves, the text box moves with it.
Select the Text1 box and press the F4 key to display the Properties window. Set the Text1 Index property to 0, which is required at design time to make an array of text controls.
You can also enhance this sample program by placing more controls into the picture box. When the picture box scrolls, all the controls scroll.
4. Add the following code to the Form Load event:
      Sub Form_Load ()
         ' Make the picture box bigger than the form:
         Picture1.Move 0, 0, 1.4 * ScaleWidth, 1.2 * ScaleHeight ' Place
            some sample controls in the picture box:
         Dim i As Integer
         For i = 1 To 20
            Load Text1(i)
            Text1(i).Visible = True
            Text1(i).Left = i * Picture1.Height / 20
            Text1(i).Top = Text1(i).Left
         Next
      End Sub
5. Add the following code to the Form Resize event:
      Sub Form_Resize ()
         ' Position the scroll bars:
         hscroll1.Left = 0
         vscroll1.Top = 0
         If Picture1.Width > scalewidth Then
            hscroll1.Top = ScaleHeight - hscroll1.Height
         Else
            hscroll1.Top = ScaleHeight
         End If
         If Picture1.Height > hscroll1.Top Then
            vscroll1.Left = scalewidth - vscroll1.Width
            If Picture1.Width > vscroll1.Left Then
               hscroll1.Top = ScaleHeight - hscroll1.Height
            End If
         Else
            vscroll1.Left = scalewidth
         End If
         hscroll1.Width = scalewidth
         If hscroll1.Top > 0 then vscroll1.Height=hscroll1.Top
         ' Set the scroll bar ranges
         hscroll1.Max = Picture1.Width - vscroll1.Left
         vscroll1.Max = Picture1.Height - hscroll1.Top
         hscroll1.SmallChange = Abs(hscroll1.Max \ 16) + 1
         hscroll1.LargeChange = Abs(hscroll1.Max \ 4) + 1
         vscroll1.SmallChange = Abs(vscroll1.Max \ 16) + 1
         vscroll1.LargeChange = Abs(vscroll1.Max \ 4) + 1
         hscroll1.ZOrder 0
         vscroll1.ZOrder 0
      End Sub
6. Add the following code to the HScroll1 Change event:
      Sub HScroll1_Change ()
         Picture1.Left = -HScroll1.Value
      End Sub
7. Add the following code to the VScroll1 Change event:
      Sub VScroll1_Change ()
         Picture1.Top = -VScroll1.Value
      End Sub
8. Start the program (or press the F5 key). Click the scroll bars to scroll the form. Close the form to end the program.




Additional reference words: 3.00 4.00 vb416
KBCategory: kbprg kbcode
KBSubcategory: PrgOther


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
Last reviewed: July 19, 1996
c1997 Microsoft Corporation. All rights reserved. Legal Notices.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

747 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

11 Experts available now in Live!

Get 1:1 Help Now