RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
Graphics.TFontStyle Enumeration

TFontStyle and TFontStyles specify style characteristics of a font.

Pascal
TFontStyle = (
  fsBold,
  fsItalic,
  fsUnderline,
  fsStrikeOut
);
C++
enum TFontStyle {
  fsBold,
  fsItalic,
  fsUnderline,
  fsStrikeOut
};

TFontStyles is a set of TFontStyle values. The following table lists the possible values of the TFontStyle type:

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!