简体   繁体   中英

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM