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 else keytp := ''; end; 记得 form的keypreview设成true
Sorry楼主,我想问下team键在键盘哪个位置
我需要 能判断 alt + t e a m的代码,至于显示什么东西自己弄了。
是按着 alt键的同时,逐个按t键e键a键m键
http://www.2ccc.com/article.asp?articleid=5712
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
else
keytp := '';
end;
记得 form的keypreview设成true