Logo New book: Delphi 2009 Handbook
My blog in online
Google
  Web www.marcocantu.com

Menu for Development

Site Menu
Delphi 2007 Handbook
Mastering Borland Delphi 2005
Essential Pascal
Essential Delphi
Buy Books Online
Code Repository
Newsgroups
White Papers
Tools
Conferences
Training
Delphi Links
Contact Marco

My Other Sites
Italian Site (www.marcocantu.it)
Developers Newsgroups Browser (dev.newswhat.com)
My town (www.piazzacavalli.net)
the delphi search
Wintech Italia (my company)

Breaking News
Buy Mastering Borland Delphi 2005 from Amazon
Free ebook: Mastering Delphi Update for Delphi 2006

Advertising
Home My Blog Books My Bookstore Development Links Marco



Home: Code Repository: Mastering Delphi 5

Project FONTBOXDEMO

Project Structure


FONTBOXDEMO.DPR

program FontBoxDemo;

uses
  Forms,
  FbDemoForm in 'FbDemoForm.pas' {Form1};

{$R *.RES}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

FBDEMOFORM.PAS

unit FbDemoForm;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, MdFontbox;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Memo1: TMemo;
    MdFontCombo1: TMdFontCombo;
    procedure FormCreate(Sender: TObject);
    procedure MdFontCombo1Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  // select the item corresponding to the current font
  MdFontCombo1.ItemIndex :=
    MdFontCombo1.Items.IndexOf (Memo1.Font.Name);
end;

procedure TForm1.MdFontCombo1Change(Sender: TObject);
begin
  // activate the new selection
  Memo1.Font.Name := MdFontCombo1.Text;
end;

end.

FBDEMOFORM.DFM

object Form1: TForm1
  Left = 207
  Top = 107
  Width = 481
  Height = 296
  Caption = 'FontBox Demo'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 99
    Top = 11
    Width = 30
    Height = 13
    Caption = '&Font:'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Memo1: TMemo
    Left = 8
    Top = 40
    Width = 457
    Height = 225
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -19
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    Lines.Strings = (
      'Text of the FontBox Demo program.'
      'More text.'
      'More text.')
    ParentFont = False
    ScrollBars = ssVertical
    TabOrder = 0
  end
  object MdFontCombo1: TMdFontCombo
    Left = 136
    Top = 8
    Width = 185
    Height = 21
    ItemHeight = 13
    TabOrder = 1
    OnChange = MdFontCombo1Change
  end
end