Marco Web Center |
Home: Code Repository: Mastering Delphi 5Project FONTBOXDEMO
Project StructureFONTBOXDEMO.DPRprogram FontBoxDemo; uses Forms, FbDemoForm in 'FbDemoForm.pas' {Form1}; {$R *.RES} begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end. FBDEMOFORM.PASunit 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.DFMobject 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
|
||
© Copyright Marco Cantù, 1995-2020, All rights reserved |