如果是键盘的键,用ASCII码来描述好象不太贴切吧?

解决方案 »

  1.   


    this.textBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Key_Press); 
     
    private void Key_Press(object sender, 
      System.Windows.Forms.KeyEventArgs e) 
      { 
      textBox1.Text = e.KeyCode.ToString(); }
      

  2.   

    方向键属于特殊键,没ASCII值,只有高字节的键盘扫描值。ASCII是底字节的键盘扫描值。
      

  3.   

    左:37
    右:39
    上:38
    下:40
    <html><script>
    function show(){
      alert("ASCII代码是:"+event.keyCode);
    }
    </script><head>
    <meta http-equiv="Content-Language" content="zh-cn">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>键盘代码-51windows.com</title>
    <style>
    <!--
    body         { font-family: Verdana; color: #000080; font-size: 9pt }
    -->
    </style>
    </head><body onkeydown="show()"><p align="center">请按键盘</p></body></html>