Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fonts in combobox

Status
Not open for further replies.

baptul

Programmer
Joined
Mar 22, 2003
Messages
8
Location
PL
I would like to view all system fonts names in combobox? What should I do?
 
You will need to use the Win32 API named EnumFonts. The following is from Borland C++ Builder How-To: The Definitive C++ Builder Problem Solver by John Miano, Tom Cabanski, and Harold Howe. On your FormCreate function do something like the following:
Code:
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  EnumFonts (Canvas->Handle, NULL, (FONTENUMPROC) EnumProc, (LPARAM) ComboBox1) ;
  ComboBox1->ItemIndex = ComboBox1->Items->IndexOf (Memo1->Font->Name) ;
}

This should load the fonts into the combo box. James P. Cottingham

When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity.
[tab][tab]Albert Einstein explaining his Theory of Relativity to a group of journalists.
 
thank you but it doesn't work. i wrote this text in formcreate function and made some correction but with no results. I think that i must use callback function EnumFontsProc but this is only a guess. Help me!!!!!!!
 
Look in the examples directory. There was a program in
there somewhere that listed a bunch of fonts it may be useful.

tomcruz.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top