Results 1 to 8 of 8

Thread: Rezize everything to fit screen

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 1999
    Posts
    184
    I heard of a magical ocx that
    resizes every form to fit the
    screen .. like directx or
    something like that.
    Could someone give me that
    ocx?

    Evan Duffield --------
    --- [email protected]
    - -
    VB6 - Learning Edition
    - -


  2. #2
    New Member
    Join Date
    Jun 2000
    Posts
    5

    Cool

    VideoSoft - VSVBX is the best one. Isn't cheap but worth the purchase.

    Dennis

  3. #3
    Guest
    Another way of doing it is to set the Form to the scrrent Screen's Height and Width. This is done by using the Screen object.

    Code:
    Private Sub Form_Resize()
    
       Me.Left = 0
       Me.Top = 0
       Me.Height = Screen.Height
       Me.Width = Screen.Width
    
    End Sub
    Another way is to set the Form's WindowState to maximized.


  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Nov 1999
    Posts
    184
    You dont understand.

    I need a way to resize the pictures,
    Text boxes.. EVERYTHING.
    Not just the form.
    Evan Duffield --------
    --- [email protected]
    - -
    VB6 - Learning Edition
    - -


  5. #5
    Guest
    Use a For Each loop and resize everything to fit the screen.

    Code:
    Dim MyObj As Object
    
    For Each MyObj In Controls
        MyObj.Move 0, 0
        MyObj.Width = Screen.Width
        MyObj.Height = Screen.Height
    Next MyObj


  6. #6
    Fanatic Member
    Join Date
    Jan 1999
    Location
    UK
    Posts
    554

    Wink

    '-->module routines
    Option Explicit

    Private Type ControlsSizes
    csTop As Single
    csLeft As Single
    csWidth As Single
    csHeight As Single
    End Type
    Private AllControls() As ControlsSizes



    '-->form rotuines
    Private Sub Form_Initialize()

    Dim counta As Integer

    ReDim Preserve AllControls(Controls.Count - 1)
    For counta = 0 To Controls.Count - 1
    With AllControls(counta)
    .csTop = Controls(counta).Top / ScaleHeight
    .csLeft = Controls(counta).Left / ScaleWidth
    .csWidth = Controls(counta).Width / ScaleWidth
    .csHeight = Controls(counta).Height / ScaleHeight
    End With
    Next

    End Sub

    Private Sub Do_Resize()

    Dim counta As Integer

    For counta = 0 To Controls.Count - 1
    With AllControls(counta)
    Controls(counta).Move .csLeft * ScaleWidth, .csTop * ScaleHeight, .csWidth * ScaleWidth, .csHeight * ScaleHeight
    End With
    Next

    End Sub

    Private Sub Form_Resize()

    Do_Resize

    End Sub



  7. #7
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    Here it is...

    ' #VBIDEUtils#************************************************************
    ' * Programmer Name : Mikhail Shmukler
    ' * Web Site : http://www.geocities.com/ResearchTriangle/6311/
    ' * E-Mail : [email protected]
    ' * Date : 13/10/98
    ' * Time : 10:24
    ' * Module Name : class_Elastic
    ' * Module Filename : Elastic.cls
    ' **********************************************************************
    ' * Comments :
    ' * This class can change size and location of controls On your form
    ' * 1. Resize form
    ' * 2. Change screen resolution
    ' * Assumes:1. Add Elastic.cls
    ' * 2. Add declaration 'Private El as New class_Elastic'
    ' * 3. Insert string like 'El.init Me' (formload event)
    ' * 4. Insert string like 'El.FormResize Me' (Resize event)
    ' * 5. Press 'F5' and resize form ....
    '
    '****************************************************************

    Option Explicit
    Private nFormHeight As Integer
    Private nFormWidth As Integer
    Private nNumOfControls As Integer
    Private nTop() As Integer
    Private nLeft() As Integer
    Private nHeight() As Integer
    Private nWidth() As Integer
    Private nFontSize() As Integer
    Private nRightMargin() As Integer
    Private bFirstTime As Boolean

    Sub Init(frm As Form, Optional nWindState As Variant)

    Dim I As Integer
    Dim bWinMax As Boolean

    bWinMax = Not IsMissing(nWindState)

    nFormHeight = frm.Height
    nFormWidth = frm.Width
    nNumOfControls = frm.Controls.Count - 1
    bFirstTime = True
    ReDim nTop(nNumOfControls)
    ReDim nLeft(nNumOfControls)
    ReDim nHeight(nNumOfControls)
    ReDim nWidth(nNumOfControls)
    ReDim nFontSize(nNumOfControls)

    ReDim nRightMargin(nNumOfControls)
    On Error Resume Next
    For I = 0 To nNumOfControls
    If TypeOf frm.Controls(I) Is Line Then
    nTop(I) = frm.Controls(I).Y1
    nLeft(I) = frm.Controls(I).X1
    nHeight(I) = frm.Controls(I).Y2
    nWidth(I) = frm.Controls(I).X2
    Else
    nTop(I) = frm.Controls(I).Top
    nLeft(I) = frm.Controls(I).Left
    nHeight(I) = frm.Controls(I).Height
    nWidth(I) = frm.Controls(I).Width
    nFontSize(I) = frm.FontSize
    nRightMargin(I) = frm.Controls(I).RightMargin
    End If
    Next

    If bWinMax Or frm.WindowState = 2 Then ' maxim
    frm.Height = Screen.Height
    frm.Width = Screen.Width
    Else
    frm.Height = frm.Height * Screen.Height / 7290
    frm.Width = frm.Width * Screen.Width / 9690
    End If

    bFirstTime = True

    End Sub

    Sub FormResize(frm As Form)

    Dim I As Integer
    Dim nCaptionSize As Integer
    Dim dRatioX As Double
    Dim dRatioY As Double
    Dim nSaveRedraw As Long

    On Error Resume Next
    nSaveRedraw = frm.AutoRedraw

    frm.AutoRedraw = True

    If bFirstTime Then
    bFirstTime = False
    Exit Sub
    End If

    If frm.Height < nFormHeight / 2 Then frm.Height = nFormHeight / 2

    If frm.Width < nFormWidth / 2 Then frm.Width = nFormWidth / 2
    nCaptionSize = 400
    dRatioY = 1# * (nFormHeight - nCaptionSize) / (frm.Height - nCaptionSize)
    dRatioX = 1# * nFormWidth / frm.Width
    On Error Resume Next ' for comboboxes, timeres and other nonsizible controls

    For I = 0 To nNumOfControls
    If TypeOf frm.Controls(I) Is Line Then
    frm.Controls(I).Y1 = Int(nTop(I) / dRatioY)
    frm.Controls(I).X1 = Int(nLeft(I) / dRatioX)
    frm.Controls(I).Y2 = Int(nHeight(I) / dRatioY)
    frm.Controls(I).X2 = Int(nWidth(I) / dRatioX)
    Else
    frm.Controls(I).Top = Int(nTop(I) / dRatioY)
    frm.Controls(I).Left = Int(nLeft(I) / dRatioX)
    frm.Controls(I).Height = Int(nHeight(I) / dRatioY)
    frm.Controls(I).Width = Int(nWidth(I) / dRatioX)
    frm.Controls(I).FontSize = Int(nFontSize(I) / dRatioX) + Int(nFontSize(I) / dRatioX) Mod 2
    frm.Controls(I).RightMargin = Int(nRightMargin(I) / dRatioY)
    End If
    Next

    frm.AutoRedraw = nSaveRedraw

    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  8. #8
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840

    Question

    I didn't think this is what Dayo312 meant (I could be wrong)

    Dayo312 mentioned DirectX resizing so I got the impression that he meant change the screen rez to match the form (thus making the form "bigger")

    Like when you have a DirectX game which actually runs in 640x480 and your screen is running at 1024x768, the screen goes black, resizes then displays the 640x480 game full screen. Where the actualy size of everything increases but the co-ord positions stay the same. Pixel size is what changes

    Or I'm miss reading the question... in which case please ignore me

    Oh, BTW, I have no idea how to do it

    Paul


    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width