unitfrmmain.pas

来自「《Delphi实用程序100例》配套书源码盘」· PAS 代码 · 共 37 行

PAS
37
字号
unit unitFrmMain;

interface

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

type
  TForm1 = class(TForm)
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
  keytp: string;
implementation
{$R *.DFM}
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  //是否按下ALT键,只接收字符
  if (shift = [ssALT]) and (key >= $41) and (key <= $5A) then
    begin
      keytp := keytp + chr(key);
      if keytp = 'ABC' then
        begin
          showmessage(' WELLCOME');
        end;
    end;
end;
end.

⌨️ 快捷键说明

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