In this second part of three of the common properties section, we’ll take a quick look at nine more properties that are common to most default VB6 objects.
The Left, Top, Width and Height properties
- The Left Property sets the distance between the internal left edge of an object and the left edge of its container.
- The Top Property sets the distance between the internal top edge of an object and the top edge of its container.
- The Width Property sets the width of an object.
- The Height Property sets the height of an object.
Example
Private Sub cmdChange_Click() Form1.Left = 12000 Form1.Top = 7000 Form1.Height = 10000 Form1.Width = 12000 End Sub
The Container property
Moves an object into another container. You don’t see it in the Properties Window, it is a run-time only property.
In this case, you need to start with the ‘Set’ keyword.
Example
Set Command1.Container = Frame1
The command1 control will be moved into frame1.
The Visible property
Determines whether an object is visible or hidden.
Example
Label1.Visible = False
The Enabled property
Determines whether an object can respond to user generated events.
Example
Text1.enabled=False
MousePointer and MouseIcon
The MousePointer property sets the type of mouse pointer over an object. The values of MousePointer property are
- 0- Default
- 1- Arrow
- 2- Cross
- 3- I-Beam
- 4- Icon
- 5- Size
- …etc…
The MouseIcon property sets a custom mouse icon from your files.
In the next and final section on common properties, we’ll take a quick look at nine more.