fmunit1.pas

来自「DELPHI设计模式书籍」· PAS 代码 · 共 51 行

PAS
51
字号
unit fmUnit1;

interface

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

type
  TfmDoc = class(TForm)
    Memo1: TMemo;
    procedure Memo1Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmDoc: TfmDoc;

implementation

uses Flyweightunit1;

{$R *.DFM}

procedure TfmDoc.Memo1Change(Sender: TObject);
var
  gc: TGlyphContext;
  times12, timesItalic12: TFont;
begin
  gc := TGlyphContext.Create;
  times12 := TFont.Create;
  times12.Name := 'Times New Roman';
  times12.Style := [];
  times12.Size := 12;
  timesItalic12 := TFont.Create;
  timesItalic12.Name := 'Times New Roman';
  timesItalic12.Style := [fsItalic];
  timesItalic12.Size := 12;
  //.....
  gc.SetFont(times12, 6);
  //....
  gc.Insert(6);
  gc.SetFont(timesItalic12,6);
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?