Two steps to be followed to disable the Copy-Paste feature in a textbox,
1) To stop right click copy/paste, disable the default menu and associate the textbox with an empty context menu that has no menu items.
2) To stop the shortcut keys you'll need to override the ProcessCmdKey method:
private const Keys CopyKey = Keys.Control | Keys.C;
private const Keys PasteKey = Keys.Control | Keys.V;
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
if((keyData == CopyKey) || (keyData == PasteKey)){
return true;
} else {
return base.ProcessCmdKey(ref msg, keyData);
}
}
Momerath
Senior Poster
3,728 posts since Aug 2010
Reputation Points: 1,322
Solved Threads: 624
Skill Endorsements: 13