in KeyPress event handler, sete.Handled = true;

解决方案 »

  1.   

    tryrichTextBox.KeyPress += new
               System.Windows.Forms.KeyPressEventHandler(richTextBox_KeyPress);
    ....void richTextBox_KeyPress(object sender,
                                 System.Windows.Forms.KeyPressEventArgs e)
    {
       if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)
          e.Handled = true;
    }
      

  2.   

    可richTextBox_KeyPress没有e.KeyCode == Keys.Up的参数
    且如我把这段程序
    if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)
          e.Handled = true;
    搬到richTextBox_KeyuUp
    也不能执行耶
    麻烦帮我解解看
    感激不尽
      

  3.   

    对不起,我没测试,有点异想天开,请试试:richTextBox.KeyDown += new KeyEventHandler(richTextBox_KeyUp);
      void richTextBox_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
    {
       if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)
          e.Handled = true;
    }
      

  4.   

    hehe, it works but the naming is bad, change "richTextBox_KeyUp" to "richTextBox_KeyDown"