实现效果:
知识运用:
KeyEventArgs类的Control,
public bool Control {get;} //获取一个值 该值指示是否曾按下Ctrl键
KeyCode和Handled属性
实现代码:
private void richTextBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control && e.KeyCode == Keys.C)
{
e.Handled = true;
MessageBox.Show("Ctrl+C组合键已经被屏蔽","温馨提示");
}
if (e.Control && e.KeyCode == Keys.V)
{
e.Handled = true;
MessageBox.Show("Ctrl+V组合键已经被屏蔽", "温馨提示");
}
if (e.Control && e.KeyCode == Keys.X)
{
e.Handled = true;
MessageBox.Show("Ctrl+X组合键已经被屏蔽", "温馨提示");
}
}