Textbox禁止剪切,复制,粘贴和弹出右键菜单
以下代码可以禁止TextBox 剪切,复制,粘贴和弹出右键菜单
protected override void WndProc(ref Message m) { /* Deny cut, copy and paste */ if (m.Msg == 0x0301) /* WM_COPY */ { return; } if (m.Msg == 0x0300) /* WM_CUT */ { return; } if (m.Msg == 0x0302) /* WM_PASTE */ { return; } /* Remove the context menu (after all we can't cut/copy/paste, so it's not much good to us anyway!) */ if (m.Msg == 0x007B) /* WM_CONTEXTMENU */ { return; } base.WndProc(ref m); }