fontlistfrm.pas

来自「关于利用DELPHI来进行企业级方案解决的著作的附书源码」· PAS 代码 · 共 62 行

PAS
62
字号
unit FontListFrm;

interface

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

type
  TFontListForm = class(TForm)
    FontListBox: TListBox;
    SizeSpinEdit: TSpinEdit;
    BitBtn1: TBitBtn;
    FontStaticText: TStaticText;
    procedure FormCreate(Sender: TObject);
    procedure FontListBoxDblClick(Sender: TObject);
    procedure SizeSpinEditChange(Sender: TObject);
    procedure FontListBoxKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FontListForm: TFontListForm;

implementation

{$R *.dfm}

procedure TFontListForm.FormCreate(Sender: TObject);
begin
  FontListBox.Items:=Screen.Fonts;
end;

procedure TFontListForm.FontListBoxDblClick(Sender: TObject);
begin
 with FontListBox do
  begin
   If ItemIndex>=0 then
    FontStaticText.Font.Name:=Items.Strings[ItemIndex];
  end;
end;

procedure TFontListForm.SizeSpinEditChange(Sender: TObject);
begin
 FontStaticText.Font.Size:=SizeSpinEdit.Value;
end;

procedure TFontListForm.FontListBoxKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
 if Key in [VK_RETURN, VK_SPACE, VK_F9] then
  FontListBoxDblClick(FontListBox);
end;

end.


⌨️ 快捷键说明

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