form1的KeyPreview设为Trueprocedure TForm1.FormKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  showmessage(IntToStr(key));
end;