抱歉,我的疏忽。这么做吧,如下代码,你一定能看懂。
- this.textControl1.KeyDown += textControl1_KeyDown;
- this.textControl1.PreviewKeyDown += textControl1_PreviewKeyDown;
- private bool flag = false;
- void textControl1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
- {
- if (e.Control && (e.KeyCode == Keys.V))
- {
- flag = true;
- }
- }
- private void textControl1_KeyDown(object sender, KeyEventArgs e)
- {
- if (flag)
- {
- e.Handled = true;
- flag = false;
- }
- }
复制代码 |