VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



To provide resolution indendepence forms through Mathematical(always provides good results!!) Calcu

by Jagadeson.S (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 5th March 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

To provide resolution indendepence forms through Mathematical(always provides good results!!) Calculations to the forms. I've tried this is

API Declarations


'For Resolution Settings
Private Declare Function GetSystemMetrics Lib "user32" (ByVal Index As Long) As Long
''


Rate To provide resolution indendepence forms through Mathematical(always provides good results!!) Calcu



    'Decl for resolution indenpendent forms
    Dim mDblPerincr As Double
    Dim lngresX As Long, lngresY As Long
    ''
    
    ' Code for setting the Form Resolution Independant
    ' The below code Fetches the resolution of the current form and
    ' ** It calculates the % of increase or decrease in size of the form comparing with the 800 X 600 resolution
    ' ** After equating the formula it gives a % value of increase in size
    ' ** The % value is used to increase or decrease the size of the objects in the form


Public Function resolution(myform As Form)
    'Decl for resolution indenpendent forms
    Dim mDblPerincr As Double
    Dim lngresX As Long, lngresY As Long
        lngresX = GetSystemMetrics(0)
        lngresY = GetSystemMetrics(1)
        mDblPerincr = lngresX / 800
        For Each Control In myform
        With Control
                    .Width = .Width * mDblPerincr
                    .Height = .Height * mDblPerincr
                    .Left = .Left * mDblPerincr
                    .Top = .Top * mDblPerincr
                    .FontSize = .FontSize * mDblPerincr
        End With
        Next
End Function

'Now call the function which inturn takes all the objects placed inside ur form
Private Sub Form_Load()
    Call resolution(Me)
End Sub

Download this snippet    Add to My Saved Code

To provide resolution indendepence forms through Mathematical(always provides good results!!) Calcu Comments

No comments have been posted about To provide resolution indendepence forms through Mathematical(always provides good results!!) Calcu. Why not be the first to post a comment about To provide resolution indendepence forms through Mathematical(always provides good results!!) Calcu.

Post your comment

Subject:
Message:
0/1000 characters