资 源 简 介
C#通过窗体的按钮来模拟按下键盘上指定键的功能,比如模拟出了Shift+Home、Delete、Enter、Home、Backspace、数字输入、英文输入等键的功能,相关功能模块代码如下,可自己添加相关的模块功能键:
private void button3_Click(object sender, System.EventArgs e)
{//Backspace空格键
this.richTextBox1.Focus();
SendKeys.Send("{Backspace}");
}
private void button4_Click(object sender, System.EventArgs e)
{ //End结束键
this.richTextBox1.Focus();
SendKeys.Send("{End}");
}
private void button5_Click(object sender, System.EventArgs e)
{//Home键
this.richTextBox1.Focus();
SendKeys.Send("{Home}");
}
private void button6_Click(object sender, System.EventArgs e)
{//Enter回车键
this.richTextBox1.Focus();
SendKeys.Send("{Enter}");
}
private void button7_Click(object sender, System.EventArgs e)
{//Delete删除键
this.richTextBox1.Focus();
SendKeys.Send("{Delete}");
}