home *** CD-ROM | disk | FTP | other *** search
- //----------------------------------------------------------------------------
- //Borland C++Builder
- //Copyright (c) 1987, 1997 Borland International Inc. All Rights Reserved.
- //----------------------------------------------------------------------------
- //---------------------------------------------------------------------------
- #include "FontList.h"
- //---------------------------------------------------------------------------
- #pragma resource "*.dfm"
- TForm1 *Form1;
- //---------------------------------------------------------------------------
- __fastcall TForm1::TForm1(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::FormCreate(TObject *Sender)
- {
- ListBox1->Items = Screen->Fonts;
- }
- //---------------------------------------------------------------------
- void __fastcall TForm1::ListBox1Click(TObject *Sender)
- {
- FontLabel->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex].c_str();
- }
- //---------------------------------------------------------------------
- void __fastcall TForm1::DrawItem(TWinControl *Control,
- int Index, TRect &Rect, TOwnerDrawState State)
- {
- ListBox1->Canvas->FillRect(Rect);
- ListBox1->Canvas->Font->Name =ListBox1->Items->Strings[Index].c_str();
- ListBox1->Canvas->Font->Size = 0;
- ListBox1->Canvas->TextOut(Rect.Left+1, Rect.Top+1, ListBox1->Items->Strings[Index].c_str());
- }
- //---------------------------------------------------------------------
- void __fastcall TForm1::ListBox1MeasureItem(TWinControl *Control,
- int Index, int &Height)
- {
- ListBox1->Canvas->Font->Name =ListBox1->Items->Strings[Index].c_str();
- ListBox1->Canvas->Font->Size = 0;
- Height = ListBox1->Canvas->TextHeight("Wg") +2;
- }
- //---------------------------------------------------------------------