1 2 unit Unit1; 3 4 interface 5 6 uses 7 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 8 Dialogs, StdCtrls; 9 10 type 11 TForm1 = class(TForm) 12 Button1: TButton; 13 ComboBox1: TComboBox; 14 procedure Button1Click(Sender: TObject); 15 procedure FormCreate(Sender: TObject); 16 procedure ComboBox1Change(Sender: TObject); 17 private 18 { Private declarations } 19 public 20 { Public declarations } 21 end; 22 23 var 24 Form1: TForm1; 25 26 implementation 27 28 {$R *.dfm} 29 30 procedure TForm1.Button1Click(Sender: TObject); 31 begin 32 //gets the pixels size of text 33 Caption :='Pixel size of text is '+ intToStr(Canvas.TextWidth('DevSuperpage.com')); 34 35 end; 36 37 procedure TForm1.FormCreate(Sender: TObject); 38 begin 39 //gets all the fonts installed on your PC and assign them to a comboox 40 combobox1.Items.AddStrings( screen.Fonts); 41 end; 42 43 procedure TForm1.ComboBox1Change(Sender: TObject); 44 begin 45 //change the font of the form to get the pixel size 46 Font.Name :=ComboBox1.Text; 47 end; 48 49 end. 50