我知道回车键是#13,但其它键是多少?从哪里可以知道?

解决方案 »

  1.   

    在OnKeyDown事件里
      ShowMessage(IntToStr(Key));
      

  2.   

    windows.pas
    找 VK_ 开头的.
      

  3.   

    li_zhifu(东北人)的方法最方便,写一个程序,可以随时查用
      

  4.   

    我编了一个软件《显示按键ascii值》,你可以在CSDN.NET下载
      

  5.   

    procedure TMainForm.FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    var
      s: string;
    begin  ValueLabel.Caption := IntToStr(Key); //将Key的值转换为字符型
      s := '';
      //显示组合键状态
      if Shift=[ssShift] then s := s + 'Shift+';
      if ssAlt    in Shift then s := s + 'Alt+';
      if ssCtrl   in Shift then s := s + 'Ctrl+';
      if Length(s) > 0 then
        Delete(s, Length(s), 1); //清除最后一个+号
      ShiftLabel.Caption := s;
      if Key in [vk_f1 .. vk_f12] then
        CharLabel.Caption := FunctionKeys[Key]
      else
        CharLabel.Caption := '';  //删除旧的字符  if Key = vk_space then
        Key := 0;
    end;
    procedure TMainForm.FormKeyPress(Sender: TObject; var Key: Char);
    begin
      if Ord(Key) in [ctrl_A .. ctrl_Z] then
        CharLabel.Caption := '^' + Chr(Ord(Key) + Ord('A') - 1)
      else
        CharLabel.Caption := Key;
      ValueLabel.Caption := IntToStr(Ord(Key));
    end;
    有问题请发信息到我的E-mail:[email protected]
      

  6.   

    你可以写一个程序来测一下不就可以了吗? KEYPRESS OR KEYDONW 你可以试一下,