是的,通过改变Delete的默认处理行为,比如下面的代码:
- private void textControl1_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Delete)
- {
- // 删除操作的历史记录
- if (textControl1.Selection.Length == 0)
- {
- this.textControl1.Selection.Length = 1;
- }
- this.textControl1.Selection.Strikeout = true;
- this.textControl1.Selection.ForeColor = Color.Red;
- this.textControl1.InputPosition = new TXTextControl.InputPosition(textControl1.InputPosition.TextPosition);
- e.Handled = true;
- }
- }
复制代码 |