Visual Form Inheritance

Creating a consistent look for the forms of an application can be a challenging task, especially when the application is quite large. form.suite4.net provides stylesheets as a means to ease the tedium connected with re-creating formatting across different forms, but it also offers another alternative — form inheritance.

Using the Form Manager, you can easily create inherited forms by right-clicking on any existing form in the Project Explorer and selecting "Inherited Form" in the context menu. A new form is added to the project, which inherits all controls and properties from the base form. It can be freely modified in the Form Designer just like the base form.

When you generate the code for the RootForm and its inherited form(s) after the design process is completed, the following changes occur:

Resetting changes in inherited forms

If you work in an inherited form in the Form Designer, you have the option to undo all or only a subset of the changes you made to any given control. This is achieved by right-clicking on the control and selecting "Reset all" or "Reset size/location" form the context menu.

Applications of visual form inheritance

In addition to the obvious benefits of using inheritance for achieving a consistent visual layout across the forms of an application, there are two more applications you may want to consider:

  1. Localization of user interface elements. Design the layout of your forms in the Form Designer and enter all label texts in the primary language, then create an inherited form for each additional language you want to support. Change the texts — and, if necessary, the control sizes — in the child forms to match the requirements of the target language.
  2. Role-based security of form data. Depending on the role of the current user, show/hide specific controls in child forms or make them read-only. This helps protect the integrity of the data your application is entrusted with.

Note: there is no technical limit to the levels of nested inheritance supported by form.suite4.net.