我在这里要求某人添加一个覆盖来禁用右键单击控件,如果不可能,是否可以禁用粘贴?
答案 0 :(得分:1)
请参阅p.campbell对how to disable copy, Paste and delete features on a textbox using C#
的回答public CueComboBox(): base()
{
//disable right click menu
ContextMenu = new ContextMenu();
}
private const Keys PasteKeys = Keys.Control | Keys.V;
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == PasteKeys)
{
return true;
}
else
{
return base.ProcessCmdKey(ref msg, keyData);
}
}