A
A
Anton2015-12-27 17:38:37
C++ / C#
Anton, 2015-12-27 17:38:37

How to properly attach the DoubleClick event to a button in windows forms?

Doesn't handle the double click event, but just click works.
here is the handler:

private void anyButton_DoubleClick(object sender, MouseEventArgs e)
        {
            MessageBox.Show("azaza");
        }

I'm screwing it like this:
cells[i, j].MouseUp += new MouseEventHandler(anyButton_Click); // работает
cells[i, j].MouseDoubleClick += new MouseEventHandler(anyButton_DoubleClick); // не работает
cells[i, j].DoubleClick += new MouseEventHandler(anyButton_DoubleClick); // не работает

this link doesn't work either:
private void anyButton_DoubleClick(object sender, EventArgs e)
        {
            MessageBox.Show("azaza");
        }

cells[i, j].DoubleClick += anyButton_DoubleClick;

What am I doing wrong? What is the cause of the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2015-12-27
Pochachalov

Found the answer on cyberforum.ru:
"Button has a DoubleClick, but the StandardDoubleClick style is missing, that's why it doesn't generate this event."

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question