Reputation: 1165
I have created a user control that should act like a button in a windows forms application.
It looks like this
public partial class ControlButton : UserControl
{
public ControlButton(String id)
{
InitializeComponent();
this.Click += new EventHandler(ControlButton_Click);
this.MouseEnter += new MouseEventHandler(ControlButton_MouseEnter);
}
}
The issue is that the Click
event does not get fired consistently. It gets clicked like every 5-6 times I click on it. There is no issue with the MouseEnter
event and it gets fired consistently.
I also tried this.MouseClick
, this.MouseDown
events to raise an event, but even these are working inconsistently.
Any idea how to solve this?
Upvotes: 0
Views: 490
Reputation: 791
Short answer: Another control or form is likely handling the WM_LBUTTONDOWN message.
Does this usercontrol have any children and is it focused before you click? This could give us more information to answer your question completely.
Have you looked at the WM_MESSAGEs the control is receiving when you click on it?
Upvotes: 1