您的位置:首页 > 教程文章 > 编程开发

C#中实现屏蔽Ctrl+C的方法

:0 :2021-04-22 22:15:14

本文实例讲述了C#实现屏蔽Ctrl+C的方法,代码简单易懂,具有一定的实用价值。分享给大家供大家参考。具体方法如下:
主要实现方法为重写 WndProc,代码如下:
public class MyTextBox : TextBox
{
public const int WM_COPY = 0x301;
public const int WM_CUT = 0x300;
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_COPY || m.Msg == WM_CUT) return;//不处理
base.WndProc(ref m);
}
}
Clipboard.SetDataObject(null);
希望本文所述C#实例对大家有所帮助。

Winform下实现图片切换特效的方法
C#实现WinForm捕获最小化事件的方法

同类资源