home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 May
/
Pcwk0597.iso
/
borland
/
cb
/
setup
/
cbuilder
/
data.z
/
FONTLIST.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1997-02-28
|
2KB
|
42 lines
//----------------------------------------------------------------------------
//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;
}
//---------------------------------------------------------------------