procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if key = 27 then
    close;
end;

解决方案 »

  1.   

    将按钮的cancel属性设成true,并在按钮的事件里写上close
      

  2.   

    procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      if Shift<>[] Then Exit;
      Case Key of
         VK_ESCAPE: BtnCloseClick(nil);
      end;
    end;要設Form1.KeyPreview := True;
      

  3.   

    将按钮的cancel属性设成true,并在按钮的事件里写上close
      

  4.   

    用ljun1979的方法也对,不过多一个按钮
    用上面的方法吧