Vcl.Forms.TApplication.MainForm

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property MainForm: TForm read FMainForm;

C++

__property TForm* MainForm = {read=FMainForm};

Properties

Type Visibility Source Unit Parent
property public
Vcl.Forms.pas
Vcl.Forms.hpp
Vcl.Forms TApplication

Description

Identifies the form in the application that is the main form.

The value of MainForm is the form that is the application's main window. The main form is the first form created in the main body of the application by a call to CreateForm. When the main form closes, the application terminates.

When you create a new project, Form1 automatically becomes the value of the MainForm property. To assign a different form to the MainForm property, select the form on the Project > Options > Forms dialog box at design time. MainForm cannot be modified at run time (it is read-only at run time).

Note: By default, the form created by the first call to CreateForm in a project becomes the application's main form. Before calling CreateForm, you can create as many forms as wanted by calling their own constructor.

Note: Before showing the MainForm, you can add a splash window. The MainForm will be shown after the initialization of the application finishes.

See Also

Code Examples