RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomForm.FormStyle Property

Determines the form's style.

Pascal
property FormStyle: TFormStyle;
C++
__property TFormStyle FormStyle;

Use FormStyle to get or set the form's style. FormStyle is one of the following values:

Value 
Meaning 
fsNormal  
The form is neither an MDI parent window nor an MDI child window.  
fsMDIChild  
The form is an MDI child window.  
fsMDIForm  
The form is an MDI parent window.  
fsStayOnTop  
This form remains on top of the desktop and of other forms in the project, except any others that also have FormStyle set to fsStayOnTop. If one fsStayOnTop form launches another, neither form will consistently remain on top.  

If the form is the main form of an MDI application, its FormStyle property must be set to fsMDIForm.

Note: It is not advisable to change FormStyle at runtime.
Warning: TGraphicControl descendants placed in the client area of a form with FormStyle set to fsMDIForm will not paint.
 

C++ Examples: 

 

/*
This example uses several forms. The first form has its
FormStyle property set to MDIForm. The others have their
FormStyle properties set to MDIChild and their Visible
properties set to true. Add a main menu component and name
one of the menu items MyArrangeIcons. This is code for the
MyArrangeIconsClick handler.  When the user chooses the
ArrangeIcons command, minimized child forms are arranged
so that they are evenly spaced and don't overlap.  DO NOT
name the menu items "ArrangeIcons" as that will override
the TForm method.
*/
void __fastcall TForm1::MyArrangeIconsClick(TObject *Sender)
{
  Form1->ArrangeIcons();
}
/*
This example uses three forms. The first form has its
FormStyle property set to MDIForm. The other two have their
FormStyle properties set to MDIChild and their Visible
properties set to true. Add a main menu component and name
one of the menu items TileForms. This is code for the
TileFormsClick handler.  When the user chooses the TileForms
command, the child forms tile vertically within the MDI frame
form.
*/
void __fastcall TForm1::TileFormsClick(TObject *Sender)
{
  TileMode = tbVertical;
  Tile();
}

 

Delphi Examples: 

{
This example uses several forms. The first form has its
FormStyle property set to MDIForm. The others have their
FormStyle properties set to MDIChild and their Visible
properties set to true. Add a main menu component and name
one of the menu items MyArrangeIcons. This is code for the
MyArrangeIconsClick handler.  When the user chooses the
ArrangeIcons command, minimized child forms are arranged
so that they are evenly spaced and don't overlap.  DO NOT
name the menu items "ArrangeIcons" as that will override
the TForm method.
} 
procedure TForm1.MyArrangeIconsClick(Sender: TObject);
begin
  Form1.ArrangeIcons;
end;
{
This example uses three forms. The first form has its
FormStyle property set to MDIForm. The other two have their
FormStyle properties set to MDIChild and their Visible
properties set to true. Add a main menu component and name
one of the menu items TileForms. This is code for the
TileFormsClick handler.  When the user chooses the TileForms
command, the child forms tile vertically within the MDI frame
form.
}
procedure TForm1.TileFormsClick(Sender: TObject);
begin
  TileMode := tbVertical;
  Tile;
end;

 

ArrangeIcons 

Tile 

Cascade 

Windows Overview

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!