Like every object on a computer, the primary characteristic of a form is its name. After creating a form, access its Properties window, click (Name), type the desired name and press Enter
When a form displays in normal view to the user, it is usually centered. The user can then drag its title bar to move it around. You too can move a form. If you want to specify the position a form would assume when it displays, at design time, access its Properties window. Then change the values of the Left and the Top properties. You can also programmatically control the location of a form. You have two options. You can assign the desired values to its Left and/or Top properties. Here is an example: Private Sub Exercise() UserForm1.Left = 400 End Sub Al alternative is to call the Move method. Its syntax is: Public Sub UserForm.Move(ByVal Left As Single, ByVal Top As Single, Optional ...) This method takes two required arguments. The first represents the left distance and the second is the top distance. Here is an example: Private Sub Exercise() UserForm1.Move 200, 200 End Sub
When you have just added a new form, it assumes a default size. If that size doesn't fit your intentions, you can change. To change the size of a form, you can access its Properties window. Then change the values of the Height and Width. To programmatically change the size of a form, you have many options. You can assign the desired values to its Height and/or to its Width. Here is an example: Private Sub Exercise() UserForm1.Width = 600 End Sub Another option is to call the Move method. In reality, this method takes two required arguments and two optional arguments. Its actual syntax is: Public Sub UserForm.Move(ByVal Left As Single, ByVal Top As Single, _ Optional ByVal Width As Single, Optional ByVal Height As Single) The last two optional arguments allow you to specify the size of the form. Here is an example: Private Sub Exercise() UserForm1.Move 200, 200, 1040, 600 End Sub
|
|
|||||||||||||
|
|
||
Previous | Copyright © 2008-2016, FunctionX, Inc. | Next |
|