Place an Object in the Center of your Screen
This will take an object on a form, and place it in the center of the screen. Good for password protection programs that take up the whole screen, this will ensure that an object that you want in the middle of the screen, will remain there for any resolution.
Original Author: Jeffrey C. Tatum
Code
'Place this in a module for use in the future:
Public Sub Object_Center(Frm As Form, Cntrl As Object)
'To call it, you would simply do:
'Call Object_Center(Form1, Text1)
'and that will center Text1 in the middle of your
'screen, no matter how big, or where Form1 is
Cntrl.Top = (Screen.Height * 1#) / 2 - Cntrl.Height / 2
Cntrl.Left = (Screen.Width * 1#) / 2 - Cntrl.Width / 2
End Sub
Comments
No comments have been added for this post.
You must be logged in to make a comment.