Delphi 中关于Button的OnClick的思考
Unit Unit1;
Interface
Uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
Type
TForm1 = Class(TForm)
Panel1: TPanel;
Button1: TButton;
Procedure Button1Click(Sender: TObject);
Procedure Panel1Click(Sender: TObject);
Private
Public
End;
Var
Form1 : TForm1;
Implementation
{$R *.dfm}
Procedure TForm1.Button1Click(Sender: TObject);
Begin
ShowMessage('Button1Click');
End;
Procedure TForm1.Panel1Click(Sender: TObject);
Begin
Form1.Button1Click(form1);
Form1.Button1.Click;
End;
End.
|
请发表评论