Chris Dunaway said:
Thanks, I used the MouseUp and that worked fine, but I still curious
why the MouseClick event does not work on a button? Since it is
derived from Control, it should support it. Unless it is some Windows
limitation.
Button.OnMouseUp, which triggers the MouseClick event, specifically checks
for the left mouse button (disassembled with .NET Reflector):
protected override void OnMouseUp(MouseEventArgs mevent)
{
if ((mevent.Button == MouseButtons.Left) && base.MouseIsPressed)
{
bool flag1 = base.MouseIsDown;
if (base.GetStyle(ControlStyles.UserPaint))
{
base.ResetFlagsandPaint();
}
if (flag1)
{
Point point1 = base.PointToScreen(new Point(mevent.X,
mevent.Y));
if ((UnsafeNativeMethods.WindowFromPoint(point1.X,
point1.Y) == base.Handle) && !base.ValidationCancelled)
{
if (base.GetStyle(ControlStyles.UserPaint))
{
this.OnClick(mevent);
}
this.OnMouseClick(mevent);
}
}
}
base.OnMouseUp(mevent);
}