Missing Assembly Reference C #

0

I have a non-usage error of Directive or a Assembly Reference pointed to KeyCod and Modifiers

Does anyone know what it would be and how can I upload it?

    private void lblAutoCod_MouseClick(object sender, MouseEventArgs e)
    {
        if (e.KeyCode == Keys.C && e.Modifiers == Keys.Control)
        {

            MessageBox.Show("You pressed ctrl + c");
        }
    }

The purpose is to make those in a click on a label the text be copied.

Follows:

    
asked by anonymous 22.09.2016 / 17:38

1 answer

5

You are confusing the event. The correct one is KeyEventArgs . Do not MouseEventArgs . Your code does not make sense.

If the goal is to test which button mouse was pressed, change the event to:

private void lblAutoCod_MouseClick(object sender, MouseEventArgs e)
{
    if (e.Button == MouseButtons.Right)
    {
        MessageBox.Show("Botão direito do mouse pressionado.");
    }
}
    
22.09.2016 / 17:56