R
riversoft
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
btnChild: TBitBtn;
procedure btnChildClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.btnChildClick(Sender: TObject);
begin
showmessage('OnClick');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
btnChild.Parent:=stringgrid1;
end;
end.
如果加btnChild.Parent:=stringgrid1;
无法相应btnChild.OnClick事件
interface
type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
btnChild: TBitBtn;
procedure btnChildClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.btnChildClick(Sender: TObject);
begin
showmessage('OnClick');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
btnChild.Parent:=stringgrid1;
end;
end.
如果加btnChild.Parent:=stringgrid1;
无法相应btnChild.OnClick事件