在查看MSDN文档时,我不太清楚何时会触发单击事件。顺序是什么? 它是:
mousedown, mouseup, click?
谢谢
这些是用于winforms的事件,更多信息请参考:Windows Forms中的鼠标事件
'点击'的定义包括鼠标按下和释放的动作。你可以通过在表单上添加一个简单的按钮,并在其被点击时显示一个MessageBox来进行演示。MessageBox只有在鼠标释放后才会出现。
如果你在谈论ASP.NET,它会在postback之后被触发。
<asp:Button ID="But" runat="server" />
在回传后您将处理该事件。
protected void Page_Load(object sender, EventArgs e)
{
But.Click += (s, ev) =>
{
// after the postback
// the method Page_Load will be called again
// re-bind the event
// and just after it this event will be called
};
}
在 MSDN 上继续查找,我找到了这个页面:http://msdn.microsoft.com/en-us/library/system.windows.forms.control.mouseclick.aspx
该页面提供了相关信息:
当光标位于控件上方并按下鼠标按钮时,通常会从控件引发以下一系列事件:
MouseDown 事件。
Click 事件。
MouseClick 事件。
MouseUp 事件。
Click
事件可能与鼠标活动无关。Click
事件将会被触发。