I have a Button with mousedown and click events addedEvents
I want to drag the Button when mousedown
public void button_MouseDown(object sender, MouseEventArgs e) { panel.DoDragDrop(((Button)sender), DragDropEffects.Move); }
A window will pop up when click
private void button_Click(object sender, EventArgs e) { Form2 fm= new Form2(); fm.ShowDialog(); }
But it seems that only the mousedown event works. do not know why?
Turn off the first one and see if the second one works. Leave the first event on, turn off the second event, and see if it has any effect.
Both the last two are turned on and see how it goes. If they can't both respond, it should be a conflict
Because your panel.DoDragDrop operation prevents normal mouse operations mousedown and mouseup. If there is no complete down and up for the same control, there will be no click event.
Well, I tried. Only one of them can respond to mouse events.
How do I realize that I want to drag the Button when the mouse is down, and a window pops up when the mouse is clicked?
How to solve it Are they conflicting?
Register mousedown and mouseup events
What operations should be performed after pressing? Make a mark after pressing, and perform operations when mousemove.
You might as well tell me what you want to achieve. Easy to give you the right direction.
The above is the detailed content of Can jquery event mousedown and click event be used at the same time?. For more information, please follow other related articles on the PHP Chinese website!