积极答复者
RTF编辑框的“粘贴”事件能否由自己的程序来接管的啊?

问题
答案
-
楼主可以。尝试拦截“”:
1)重新创建一个类:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication1 { public class MyRichTextBox : RichTextBox { /// <summary> /// 中段底层拦截,强制Ctrl+V不起作用 /// </summary> protected override bool ProcessCmdKey(ref Message m, Keys keyData) { if (keyData==(Keys.Control | Keys.V)) { //TODO: 此处写你的自己逻辑 MessageBox.Show("无法处理Ctrl+V!"); return true; } return base.ProcessCmdKey(ref m, keyData); } } }
2)重新清理并编译整个项目,直接把生成的新的RichTextBox控件拖拽到界面上即可:
ASP.NET Forum
Other Discussion Forums
FreeRice Donate
Issues to report
Free Tech Books Search and Download- 已标记为答案 liubin 2015年2月22日 11:36
全部回复
-
-
楼主可以。尝试拦截“”:
1)重新创建一个类:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication1 { public class MyRichTextBox : RichTextBox { /// <summary> /// 中段底层拦截,强制Ctrl+V不起作用 /// </summary> protected override bool ProcessCmdKey(ref Message m, Keys keyData) { if (keyData==(Keys.Control | Keys.V)) { //TODO: 此处写你的自己逻辑 MessageBox.Show("无法处理Ctrl+V!"); return true; } return base.ProcessCmdKey(ref m, keyData); } } }
2)重新清理并编译整个项目,直接把生成的新的RichTextBox控件拖拽到界面上即可:
ASP.NET Forum
Other Discussion Forums
FreeRice Donate
Issues to report
Free Tech Books Search and Download- 已标记为答案 liubin 2015年2月22日 11:36