Enlarging form to user's screen size 
Author Message
 Enlarging form to user's screen size

I know many people have posted a subject like this, but this is different.

I purchased the incredible Sybex book Access97 develolper's handbook
(Litwin,Getz,Gilbert) and have used their code to enlarge forms designed at
different screen sizes to match other users varying screen sizes and it
works GREAT.  But, I'd now like to use that code in a VB5.0 app I'm
creating.

I'm having problems with code that is Access specific, and debugging it has
become a pain.  Has anyone done what I am trying?

I'll supply some code if anyone wants to help me debug it.  Thanks all.

Eric



Mon, 05 Feb 2001 03:00:00 GMT  
 Enlarging form to user's screen size
Let me a chance:

--
FlyKiller
HomePage: http://home.tvd.be/ws36009
ICQ: 6351237

Quote:

>I know many people have posted a subject like this, but this is different.

>I purchased the incredible Sybex book Access97 develolper's handbook
>(Litwin,Getz,Gilbert) and have used their code to enlarge forms designed at
>different screen sizes to match other users varying screen sizes and it
>works GREAT.  But, I'd now like to use that code in a VB5.0 app I'm
>creating.

>I'm having problems with code that is Access specific, and debugging it has
>become a pain.  Has anyone done what I am trying?

>I'll supply some code if anyone wants to help me debug it.  Thanks all.

>Eric



Mon, 05 Feb 2001 03:00:00 GMT  
 Enlarging form to user's screen size
Try something like:
form1.width = screen.width

You can substitute width with top, height and left.

--darren b

Quote:

>I purchased the incredible Sybex book Access97 develolper's handbook
>(Litwin,Getz,Gilbert) and have used their code to enlarge forms designed at
>different screen sizes to match other users varying screen sizes and it
>works GREAT.  But, I'd now like to use that code in a VB5.0 app I'm
>creating.

[snip]


Mon, 05 Feb 2001 03:00:00 GMT  
 Enlarging form to user's screen size
Here is some code that will return the size and position of the
desktop, this also accounts for the task bar as well.

' Place this code in a module

Public Const SPI_GETWORKAREA = 48

Public Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

Public Declare Function SystemParametersInfo Lib "user32" Alias _
"SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long

Public Sub GetDesktopSize(L As Single, T As Single, W As Single, _
H As Single)

Dim ScreenSize As RECT

    If SystemParametersInfo(SPI_GETWORKAREA, vbNull, ScreenSize, _
    0) Then
        With ScreenSize
            L = Screen.TwipsPerPixelX * .Left
            T = Screen.TwipsPerPixelX * .Top
            W = Screen.TwipsPerPixelX * (.Right - .Left)
            H = Screen.TwipsPerPixelX * (.Bottom - .Top)
        End With
    Else
        L = 0
        T = 0
        W = 0
        H = 0
    End If

End Sub

' Place this code in the Form you wish to resize

Private Sub Form_Load()
Dim L As Single
Dim T As Single
Dim W As Single
Dim H As Single
    GetDesktopSize L, T, W, H
    Me.Move L, T, W, H
End Sub

------------------

After rereading your post I'm now not sure what mean. Do you mean just changing the window size? If so then the above code will solve this.

But if you mean Adjusting all the controls on a window as well?

Use the above code to change the window size. Then place code in the Resize event of a form to reposition and resize the controls on a form. Use the form's scalewidth and scaleheight properties to determine the usable area of the form.

Simple example

Private Sub Form_Resize()
' This will make a three pane view using three text boxes
' You may want to have the Gutter Variables declared Public in a module
' So that you can use them for every form your project has
Const Gutter As Integer = 2
Dim GutterX As Single
Dim GutterY As Single
Dim SW As Single
Dim SH As Single
Dim L As Single
Dim T As Single
    GutterX = Gutter * Screen.TwipsPerPixelX
    GutterY = Gutter * Screen.TwipsPerPixelY
    SW = Me.ScaleWidth
    SH = Me.ScaleHeight
    Text1.Move 0, 0, SW / 3, SH
    L = Text1.Width + GutterX
    Text2.Move L, 0, SW - L, SH / 2
    T = Text2.Height + GutterY
    Text3.Move L, T, SW - L, SH - T
End Sub

--
Lea Johnson
IT Services Centre, ADFA

To reply via E-Mail, please remove 'nospam.' from the return E-Mail address

Quote:

>I know many people have posted a subject like this, but this is different.

>I purchased the incredible Sybex book Access97 develolper's handbook
>(Litwin,Getz,Gilbert) and have used their code to enlarge forms designed at
>different screen sizes to match other users varying screen sizes and it
>works GREAT.  But, I'd now like to use that code in a VB5.0 app I'm
>creating.

>I'm having problems with code that is Access specific, and debugging it has
>become a pain.  Has anyone done what I am trying?

>I'll supply some code if anyone wants to help me debug it.  Thanks all.

>Eric



Tue, 06 Feb 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. how to handle user's screen size?

2. can't make form bigger than size of the screen in VB

3. can't make form bigger than size of the screen in VB

4. Screen Resolution's and Scalable Form size

5. Adjust forms to users' screen resolution

6. Best way to size a form to different screen sizes

7. Sizing forms for users with different monitor size

8. Stopping a user Resize or enlarge

9. get the screen's size

10. Enlarging Outlook's Window

11. Here's How to limit a form's size

12. form doesn't auto size to fit different pc's

 

 
Powered by phpBB® Forum Software