B
bnbchinafbi
Unregistered / Unconfirmed
GUEST, unregistred user!
问题1: procedure Button1Click(Sender: TObject);中的Sender参数有什么用?
问题2: 单击 Button1后,为什么Button1会消失?
问题3: myobj的类型为什么是TButton?
请看下面的程序:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Tmyobj=class
procedure MyobjOne;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ Tmyobj }
procedure Tmyobj.MyobjOne;
begin
showmessage('MyobjOne');
end;
procedure TForm1.Button1Click(Sender: TObject);
var
myobj:Tmyobj;
begin
myobj.Create ;
myobj.MyobjOne ;
myobj.Free ;
end;
end.
问题2: 单击 Button1后,为什么Button1会消失?
问题3: myobj的类型为什么是TButton?
请看下面的程序:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Tmyobj=class
procedure MyobjOne;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ Tmyobj }
procedure Tmyobj.MyobjOne;
begin
showmessage('MyobjOne');
end;
procedure TForm1.Button1Click(Sender: TObject);
var
myobj:Tmyobj;
begin
myobj.Create ;
myobj.MyobjOne ;
myobj.Free ;
end;
end.