[英]C#, mouseClickEvent doesn't respond to right mouse click
on click event doesn't respond to right mouse click. 点击事件不响应鼠标右键单击。 The event is for a richTextBox.
该事件适用于richTextBox。 when I try the same code on the form it works fine.
当我在表单上尝试相同的代码时,它工作正常。
what could be the problem? 可能是什么问题呢?
EDIT: I use winforms 编辑:我使用winforms
You need to check it on the MouseDown event. 您需要在MouseDown事件上进行检查。
private void TextBox_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
wasRightButtonClicked = true;
}
The Click and MouseClick events are only generated by a left-click. Click和MouseClick事件仅通过左键单击生成。 If you want to detect right-clicks then you have to implement the MouseDown or MouseUp event.
如果要检测右键单击,则必须实现MouseDown或MouseUp事件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.