C# Event by pressing button, not by clicking

Asked

Viewed 138 times

1

I need to perform a function exactly by pressing the button.

For the common function Botao1_Click it only executes when you release the click, I mean, if you click and hold a little time pressed it does not perform. If you hold 2 seconds by pressing, the function also does not run; it is only called after you release the click.

private void Button1_Click(object sender, EventArgs e)
{ minha_funcao(); }
  • Solved. The correct option is to trigger the mouseDown event.

1 answer

-1

Good morning.

This is using another event in the event list there you find several other events besides the click event. This difficulty of yours is perhaps due to the fact that it uses the creation of the method giving two clicks on the control.

In the event area choose the desired event and program the desired function.

  • Consider putting this type of text as a comment.

  • Yes, yes, mouseDown is on the list of events.... that’s right....

Browser other questions tagged

You are not signed in. Login or sign up in order to post.