RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TFont.Style Property

Determines whether the font is normal, italic, underlined, bold, and so on.

Pascal
property Style: TFontStyles;
C++
__property TFontStyles Style;

Use Style to add special characteristics to characters that use the font. Style is a set containing zero or more values from the following:

Value 
Meaning 
fsBold  
The font is boldfaced.  
fsItalic  
The font is italicized.  
fsUnderline  
The font is underlined.  
fsStrikeOut  
The font is displayed with a horizontal line through it.  

 

C++ Examples: 

/*
This example demonstrates how to set and clear font styles.
This example requires a button and a label that has text
with some styles set.
*/
void __fastcall TForm1::Button1Click(TObject *Sender)
{
   Label1->Font->Style = TFontStyles() << fsBold << fsUnderline;
}
/*
This example demonstrates how to clear any Styles that were previously set.
*/
void __fastcall TForm1::Button2Click(TObject *Sender)
{
   Label1->Font->Style = TFontStyles();
}

 

Delphi Examples: 

{
This example demonstrates how to set and clear font styles.
This example requires a button and a label that has text
with some styles set.
} 
procedure TForm1.Button1Click(Sender: TObject);
begin
   Label1.Font.Style := [fsBold, fsUnderline];
end;
{
This code demonstrates how to clear any Styles that were
previously set.
}
procedure TForm1.Button2Click(Sender: TObject);
begin
   Label1.Font.Style := [];
end;

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!