VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



A function to easily Center any object on a form, bothe vertically and horizontally.

by yar-interactive software (2 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 18th October 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

A function to easily Center any object on a form, bothe vertically and horizontally.

Rate A function to easily Center any object on a form, bothe vertically and horizontally.



'OwnerForm is the form that the Object is on.

Public Sub CenterImage(ObjectToCenter As Object, OwnerForm As Form)
ObjectToCenter.Top = ((OwnerForm.ScaleHeight - ObjectToCenter.Height) / 2)
ObjectToCenter.Left = ((OwnerForm.ScaleWidth - ObjectToCenter.Width) / 2)
'For more VB, great software and more goto http://www.yarinteractive.com
'The Homepage of yar-interactive software
End Sub

Download this snippet    Add to My Saved Code

A function to easily Center any object on a form, bothe vertically and horizontally. Comments

No comments have been posted about A function to easily Center any object on a form, bothe vertically and horizontally.. Why not be the first to post a comment about A function to easily Center any object on a form, bothe vertically and horizontally..

Post your comment

Subject:
Message:
0/1000 characters