Solved

Independent Video Resolution

Posted on 1998-12-03
4
227 Views
Last Modified: 2012-05-04
I need run my Aplication, independent of Video Resolution and fonts definations...
0
Comment
Question by:hasabin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1448000
Fine, for you. Create it in 640x480
0
 
LVL 14

Accepted Solution

by:
waty earned 100 total points
ID: 1448001
Try this class :

'****************************************************************
' Name: class_Elastic
' Description:This class can change size and location of controls
'  on your form
' 1. Resize form
' 2. Change screen resolution

' By: Mikhail Shmukler
'
' Inputs:None
' Returns:None
' Assumes:1. Add Elastic.cls
'2. Add declaration 'private clsElastic as New class_Elastic'
'3. Insert string like 'clsElastic.init Me' (formload event)
'4. Insert string like 'clsElastic.FormResize Me' (Resize event)
'5. Press 'F5' and resize form ....
'
'****************************************************************

Option Explicit
Private iFormHeight      As Integer
Private iFormWidth       As Integer
Private iNumOfControls   As Integer
Private iTop()           As Integer
Private iLeft()          As Integer
Private iHeight()        As Integer
Private iWidth()         As Integer
Private iFontSize()      As Integer
Private iRightMargin()   As Integer
Private bFirstTime       As Boolean

Sub Init(FormName As Form, Optional WindState)
   
   Dim I         As Integer
   Dim WinMax    As Boolean
   
   WinMax = Not IsMissing(WindState)
   
   iFormHeight = FormName.Height
   iFormWidth = FormName.Width
   iNumOfControls = FormName.Controls.Count - 1
   bFirstTime = True
   ReDim iTop(iNumOfControls)
   ReDim iLeft(iNumOfControls)
   ReDim iHeight(iNumOfControls)
   ReDim iWidth(iNumOfControls)
   ReDim iFontSize(iNumOfControls)
   
   ReDim iRightMargin(iNumOfControls)
   On Error Resume Next
   For I = 0 To iNumOfControls
      If TypeOf FormName.Controls(I) Is Line Then
         iTop(I) = FormName.Controls(I).Y1
         iLeft(I) = FormName.Controls(I).X1
         iHeight(I) = FormName.Controls(I).Y2
         iWidth(I) = FormName.Controls(I).X2
      Else
         iTop(I) = FormName.Controls(I).Top
         iLeft(I) = FormName.Controls(I).Left
         iHeight(I) = FormName.Controls(I).Height
         iWidth(I) = FormName.Controls(I).Width
         iFontSize(I) = FormName.FontSize
         iRightMargin(I) = FormName.Controls(I).RightMargin
      End If
   Next
   
   If WinMax Or FormName.WindowState = 2 Then ' maxim
      FormName.Height = Screen.Height
      FormName.Width = Screen.Width
   Else
      FormName.Height = FormName.Height * Screen.Height / 7290
      FormName.Width = FormName.Width * Screen.Width / 9690
   End If
   
   bFirstTime = True
   
End Sub


Sub FormResize(FormName As Form)
   
   Dim I             As Integer
   Dim Inc           As Integer
   Dim CaptionSize   As Integer
   Dim RatioX        As Double
   Dim RatioY        As Double
   Dim SaveRedraw    As Long
   
   On Error Resume Next
   SaveRedraw = FormName.AutoRedraw
   
   FormName.AutoRedraw = True
   
   If bFirstTime Then
      bFirstTime = False
      Exit Sub
   End If
   
   If FormName.Height < iFormHeight / 2 Then FormName.Height = iFormHeight / 2
   
   If FormName.Width < iFormWidth / 2 Then FormName.Width = iFormWidth / 2
   CaptionSize = 400
   RatioY = 1# * (iFormHeight - CaptionSize) / (FormName.Height - CaptionSize)
   RatioX = 1# * iFormWidth / FormName.Width
   On Error Resume Next ' for comboboxes, timeres and other nonsizible controls
   
   For I = 0 To iNumOfControls
     
      If TypeOf FormName.Controls(I) Is Line Then
         FormName.Controls(I).Y1 = Int(iTop(I) / RatioY)
         FormName.Controls(I).X1 = Int(iLeft(I) / RatioX)
         FormName.Controls(I).Y2 = Int(iHeight(I) / RatioY)
         FormName.Controls(I).X2 = Int(iWidth(I) / RatioX)
      Else
         FormName.Controls(I).Top = Int(iTop(I) / RatioY)
         FormName.Controls(I).Left = Int(iLeft(I) / RatioX)
         FormName.Controls(I).Height = Int(iHeight(I) / RatioY)
         FormName.Controls(I).Width = Int(iWidth(I) / RatioX)
         FormName.Controls(I).FontSize = Int(iFontSize(I) / RatioX) + Int(iFontSize(I) / RatioX) Mod 2
         FormName.Controls(I).RightMargin = Int(iRightMargin(I) / RatioY)
      End If
     
   Next
   
   FormName.AutoRedraw = SaveRedraw
   
End Sub

0
 

Author Comment

by:hasabin
ID: 1448002
I test this solution, but I still have problens with fonts,
When I configure "large Fonts " in Proprieties of Video...!
Obs. I work with resolution 800X640 .and. large fonts
0
 

Expert Comment

by:FabioCristiano
ID: 1448003
Idéia interessante. Irei testar em casa...
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

691 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