http://www.functionx.com/bcb/howto/fontstyles.htm
//--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::FormCreate(TObject *Sender) { for(int i = 0; i < Screen->Fonts->Count; i++) cboFont->Items->Add(Screen->Fonts->Strings[i]); } //--------------------------------------------------------------------------- void __fastcall TForm1::cboFontChange(TObject *Sender) { lblPreview->Font->Name = cboFont->Items->Strings[cboFont->ItemIndex]; } //--------------------------------------------------------------------------- void __fastcall TForm1::cboFontSizeChange(TObject *Sender) { lblPreview->Font->Size = StrToInt(cboFontSize->Text); } //--------------------------------------------------------------------------- void __fastcall TForm1::cboColorChange(TObject *Sender) { lblPreview->Font->Color = cboColor->Selected; } //--------------------------------------------------------------------------- void __fastcall TForm1::chkBoldClick(TObject *Sender) { if( chkBold->Checked ) lblPreview->Font->Style = lblPreview->Font->Style << fsBold; else lblPreview->Font->Style = lblPreview->Font->Style >> fsBold; } //--------------------------------------------------------------------------- void __fastcall TForm1::chkItalicClick(TObject *Sender) { if( chkItalic->Checked ) lblPreview->Font->Style = lblPreview->Font->Style << fsItalic; else lblPreview->Font->Style = lblPreview->Font->Style >> fsItalic; } //--------------------------------------------------------------------------- void __fastcall TForm1::chkUnderlineClick(TObject *Sender) { if( chkUnderline->Checked ) lblPreview->Font->Style = lblPreview->Font->Style << fsUnderline; else lblPreview->Font->Style = lblPreview->Font->Style >> fsUnderline; } //--------------------------------------------------------------------------- void __fastcall TForm1::chkStrikeoutClick(TObject *Sender) { if( chkStrikeout->Checked ) lblPreview->Font->Style = lblPreview->Font->Style << fsStrikeOut; else lblPreview->Font->Style = lblPreview->Font->Style >> fsStrikeOut; } //---------------------------------------------------------------------------