window mobile 快捷键 (以及防止#的输入)

一定要注意keypreview=true;

 

 

window mobile 快捷键 (以及防止#的输入)_第1张图片

form1

代码:

using System; using System.Linq; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace form6 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue == 51) { //e.Handled = true; //将Handled设置为true,指示已经处理过KeyPress事件 button1_Click(null, null); //e.Handled = true; //将Handled设置为true,指示已经处理过KeyPress事件 //MessageBox.Show(e.KeyCode.ToString()); //MessageBox.Show(e.KeyData.ToString()); //MessageBox.Show(e.KeyValue.ToString()); } //MessageBox.Show(e.KeyCode.ToString()); //MessageBox.Show(e.KeyData.ToString()); //MessageBox.Show(e.KeyValue.ToString()); } private void button2_Click(object sender, EventArgs e) { MessageBox.Show("88888888888"); } private void button1_Click(object sender, EventArgs e) { MessageBox.Show("wgb"); } private void textBox1_KeyPress_1(object sender, KeyPressEventArgs e) { if (e.KeyChar.ToString() == "#") { e.Handled = true; //将Handled设置为true,指示已经处理过KeyPress事件 //MessageBox.Show(e.KeyChar.ToString()); } } } } 

 

你可能感兴趣的:(object,null,Class,mobile,button,textbox)