Compartir a través de


Overriding Default Property Settings

For a user-defined class, you can change the default values for properties that are not marked as Protected when you add objects based on that class to a form. This action overrides the default values of those properties as defined by the class. If you later change the default values for properties in the class, for example, using the Class Designer, the values of those properties for the object on the form are not affected.

However, if you do not change the default property value when you add the object to the form and you change the default property value in the class, the property value of the object changes to match the new default value.

For example, suppose you add a command button based on a user-defined class to a form and changes the BackColor property from white to red. If you change the default value of the BackColor property in the user-defined class to green, the back color of the command button on the form remains red. However, if you do not change the back color of the command button and you change the default value color of the BackColor property in the class to green, the back color of the command button on the form inherits the change and is set to green.

See Also

Concepts

Overriding and Calling Parent Class Code

Working with Classes in Visual FoxPro