delphi或asp高手请进

来源:百度知道 编辑:UC知道 时间:2024/06/15 06:54:46
编程中,知道回车键值是#13 那是不是所有键盘上的键都有对应的值呢?那都是多少呢?

在keydown事件里面
showmessage(inttostr(key));
在keypress事件里面
showmessage(key);
就知道了。

Form1.KeyPreview := True;

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
Showmessage(IntToStr(Key));
end;

procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
Showmessage(IntToStr(Ord(Key)));
end;

{ Virtual Keys, Standard Set }
{$EXTERNALSYM VK_LBUTTON}
VK_LBUTTON = 1;
{$EXTERNALSYM VK_RBUTTON}
VK_RBUTTON = 2;
{$EXTERNALSYM VK_CANCEL}
VK_CANCEL = 3;
{$EXTERNALSYM VK_MBUTTON}
VK_MBUTTON = 4; { NOT contiguous with L & RBUTTON }
{$EXTERNALSYM VK_BACK}
VK_BACK = 8;
{$EXTERNALSYM VK_TAB}
VK_TAB = 9;
{$EXTERNALSYM VK_CLEAR}
VK_CLEAR = 12;
{$EXTERNALSYM VK_RETURN}
VK_RETURN = 13;
{$EXTERNALSYM VK_SHIFT}
VK_SHIFT = $10;
{$EXTERNALSYM VK_CONTROL}
VK_CONTROL = 17;