开发者

C#, mouseClickEvent doesn't respond to right mouse click

开发者 https://www.devze.com 2023-01-04 19:08 出处:网络
on click event doesn\'t respond to right mouse click. 开发者_运维问答The event is for a richTextBox.

on click event doesn't respond to right mouse click. 开发者_运维问答The event is for a richTextBox. when I try the same code on the form it works fine.

what could be the problem?

EDIT: I use winforms


You need to check it on the MouseDown event.

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. If you want to detect right-clicks then you have to implement the MouseDown or MouseUp event.

0

精彩评论

暂无评论...
验证码 换一张
取 消