procedure TForm1.FormClick(Sender: TObject);为什么会响应用户的OnClick事件(全天在线) ( 积分: 30 )

  • 主题发起人 主题发起人 suncheng_hong
  • 开始时间 开始时间
S

suncheng_hong

Unregistered / Unconfirmed
GUEST, unregistred user!
为什么FormClick与OnClick &nbsp;FormPaint与OnPaint相对应?<br>苦恼中,兄弟们帮忙<br> &nbsp; &nbsp; //////////<br> &nbsp; &nbsp; &nbsp; &nbsp; / &nbsp;_ &nbsp; _ &nbsp;/<br> &nbsp; &nbsp; &nbsp; &nbsp;(| (.) (.) |)<br> _____.OOOo__( )__oOOO.______<br>| &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|<br>| &nbsp; &nbsp; &nbsp; &nbsp; 求救!!!   &nbsp; &nbsp; &nbsp;|<br>| &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|<br>|____.oooO___________________|<br> &nbsp; &nbsp; ( &nbsp; ) &nbsp; &nbsp; &nbsp; &nbsp;Oooo.<br> &nbsp; &nbsp; &nbsp;/ ( &nbsp; &nbsp; &nbsp; &nbsp; ( &nbsp; )<br> &nbsp; &nbsp; &nbsp; /_) &nbsp; &nbsp; &nbsp; &nbsp; ) /<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(_/
 
为什么FormClick与OnClick &nbsp;FormPaint与OnPaint相对应?<br>苦恼中,兄弟们帮忙<br> &nbsp; &nbsp; //////////<br> &nbsp; &nbsp; &nbsp; &nbsp; / &nbsp;_ &nbsp; _ &nbsp;/<br> &nbsp; &nbsp; &nbsp; &nbsp;(| (.) (.) |)<br> _____.OOOo__( )__oOOO.______<br>| &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|<br>| &nbsp; &nbsp; &nbsp; &nbsp; 求救!!!   &nbsp; &nbsp; &nbsp;|<br>| &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|<br>|____.oooO___________________|<br> &nbsp; &nbsp; ( &nbsp; ) &nbsp; &nbsp; &nbsp; &nbsp;Oooo.<br> &nbsp; &nbsp; &nbsp;/ ( &nbsp; &nbsp; &nbsp; &nbsp; ( &nbsp; )<br> &nbsp; &nbsp; &nbsp; /_) &nbsp; &nbsp; &nbsp; &nbsp; ) /<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(_/
 
procedure TForm1.FormClick(Sender: TObject);<br>begin<br> &nbsp;ShowMessage('You Info...');<br>end;
 
首先,OnClick是一个TNotifyEvent类型的属性,就是一个方法指针,用于保存指向<br>TNotifyEvent类型方法的指针,TForm类直接继承自TCustomForm,而它们的共同祖先类<br>是TControl,这些类的消息处理过程中,要利用OnClick属性访问Click的相应处理过程,<br>如果OnClick有值(即有方法的地址挂靠上这个OnClick),那么根据地址就可以直接调用到<br>处理过程,如果没有值,就作默认处理。所以,Delphi用这样的方式方便了编程人员,当你<br>在设计器中双击OnClick时,会自动跳到procedure TForm1.FormClick(Sender: TObject);<br>的编辑区,可以在下面编辑处理代码,这个过程中,系统已经将TForm1.FormClick这个过程<br>的地址赋值给OnClick属性了,所以在TForm1内部访问OnClick属性时就会直接调用到<br>TForm1.FormClick这个过程。<br>一句话,OnClick保存了事件处理过程的地址,所以看起来就是TForm1.FormClick<br>响应了OnClick。
 
系统已经将TForm1.FormClick这个过程<br>的地址赋值给OnClick属性了?这是怎么实现的<br>VCL中有没有对应的代码呢
 
哪个函数调用TForm1.FormClick这个过程?<br>VCL高手请进
 
在哪个单元中
 
多人接受答案了。
 
后退
顶部