/*
Font, Execute, OnApply, Assign example
This example takes an edit control, a button, and a rich edit control on a form.  When the user presses the button, a Font dialog appears.  When the user clicks the Apply button in the Font dialog, the currently selected font is applied to the active control. 
*/ 
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  TFontDialog1->Options << fdApplyButton;
  TFontDialog1->Execute();
}
void __fastcall TForm1::FontDialog1Apply(TObject *Sender, HWND Wnd)
{
  if (ActiveControl->ClassNameIs("TEdit"))
   ((TEdit *)ActiveControl)->Font->Assign(TFontDialog1->Font);
  else if (ActiveControl->ClassNameIs("TRichEdit"))
    ((TRichEdit *)ActiveControl)->SelAttributes->Assign(TFontDialog1->Font);
  else
    MessageBeep(0);
} 
