VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Function allows a form to be resized and re-centered automatically

by Michael Hammer (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 20th January 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Function allows a form to be resized and re-centered automatically

API Declarations


' I.e.
FRMNormal=2700
FRMExpanded=2900
' Usage is AdjustFormSize(Me,FrmExpanded,,,true)


Rate Function allows a form to be resized and re-centered automatically



' Sub Name: AdjustFormHeight
' Written By: Michael Hammer - [email protected]
' Code may be used in programs as long as credit is given where credit is 
' Needed.  Thank you
' Purpose: This Subroutine resizes a form and centers it on the screen.
'          Or in the Form named in the Parent Argument
Child.Height = NewHeight ' Set new height
If NewWidth > 0 Then
    Child.Width = NewWidth ' Set New Width
End If
If Center Then
    If Parent Is Nothing Then  ' If Parent was not enterd2
        Child.Left = Screen.Width / 2 - Child.Width / 2
        Child.Top = Screen.Height / 2 - Child.Height / 2
    Else
        Child.Left = Parent.ScaleWidth / 2 - Child.Width / 2
        Child.Top = Parent.ScaleHeight / 2 - Child.Height / 2
    End If
End If
End Sub

Download this snippet    Add to My Saved Code

Function allows a form to be resized and re-centered automatically Comments

No comments have been posted about Function allows a form to be resized and re-centered automatically. Why not be the first to post a comment about Function allows a form to be resized and re-centered automatically.

Post your comment

Subject:
Message:
0/1000 characters