⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmemento.pas

📁 delphi深度探索第二版随书光盘所附内容
💻 PAS
字号:
unit CMemento;

interface

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

type
  TForm1 = class(TForm)
    btn1: TButton;
    btn2: TButton;
    procedure btn1Click(Sender: TObject);
    procedure btn2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.btn1Click(Sender: TObject);
begin
  with Self.Canvas do
  begin
    //先用五号宋体写一句话
    Font.Name := '宋体';
    Font.Size := 11;
    textout(100, 100, '宋体五号');
    //再用二号黑体写一句话
    Font.Name := '黑体';
    Font.Size := 22;
    textout(100, 150, '黑体二号');
    //再用五号宋体写一句话
    Font.Name := '宋体';
    Font.Size := 11;
    textout(100, 200, '宋体五号');
  end;
end;

procedure TForm1.btn2Click(Sender: TObject);
var
  FR: TFontRecall;
begin
  with Self.Canvas do
  begin
    //先用五号宋体写一句话
    Font.Name := '宋体';
    Font.Size := 11;
    textout(100, 100, '宋体五号');
    FR := TFontRecall.Create(Font);
    try
      //再用二号黑体写一句话
      Font.Name := '黑体';
      Font.Size := 22;
      textout(100, 150, '黑体二号');
    finally
      FR.Free;
    end;
    //再用五号宋体写一句话
    textout(100, 200, '宋体五号');
  end;
end;

end.

⌨️ 快捷键说明

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