键值
//键盘键值
private void ChangeKey(TextBox textBox,System.Windows.Forms.KeyEventArgs e,int i)
{
if((e.KeyValue>=32 && e.KeyValue<=40) || (e.KeyValue>=45 && e.KeyValue<=46) || (e.KeyValue>=48 && e.KeyValue<=57) || (e.KeyValue>=65 && e.KeyValue<=90) ||
(e.KeyValue>=96 && e.KeyValue<=107) || (e.KeyValue>=109 && e.KeyValue<=111) || (e.KeyValue>=186 && e.KeyValue<=192) ||
(e.KeyValue>=219 && e.KeyValue<=222))//键盘键值
{
textBox.Text=e.KeyCode.ToString();
this.keys[i]=e.KeyCode;
}
}
//将字符串转换为相对应的键
Keys keys=new Keys[5];
for(int i=0;i<nodes[2].ChildNodes.Count;i++)
{
KeysConverter kc=new KeysConverter();
this.keys[i]=(Keys)(kc.ConvertFromString(nodes[2].ChildNodes[i].InnerText));
}
本文来自博客园,作者:NLazyo,转载请注明原文链接:https://www.cnblogs.com/bile/archive/2011/09/02/2164347.html