InvokeOnClick()的初步理解
onkeypress函数是在键盘上输入或操作时,引入InvokeOnClick,就可以触发下面的ButtonOnClick方法;
点击InvokeOnClick就可以看到它的内部构造如下:
从上面可以看出,实际上,触发的是OnClick事件。
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Where is InvokeOnClick() method called when I click a button in C# WinForms?
InvokeOnClick
is currently not used.
The Click
event is raised by the Control.OnClick
method:
EventHandler handler = (EventHandler)Events[EventClick];
if (handler != null) handler(this, e);
For a Button
, this occurs e.g. on mouse up and on calling PerformClick
: see here.