D
del_today
Unregistered / Unconfirmed
GUEST, unregistred user!
各位高手:
以下简单代码为一个自动随机出题的小程序,通过该例我想问几个基本概念:
1、其中代码
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
是否为一个TFrom1类的定义?
2、在该TFrom1类的定义中,哪个是类的属性、哪个是类的方法?是Button1: TButton;和
procedure Button1Click(Sender: TObject);吗?
3、“类的属性、类的方法”这句话的说法对吗?还是应该说“对象的属性、对象的方法”?
4、该TFrom1类的定义该怎样理解?我只知道类可以生成对象实例,但一到具体代码我就晕了。
请各位高手详细指教,能举例最好!
**************************************************************
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
begin
Randomize;
for I := 1 to 10 do begin
Canvas.TextOut(20,I*20,
IntToStr(Random(9)+1)+'×'+IntToStr(Random(9)+1)+'=');
Canvas.TextOut(220,I*20,
IntToStr(Random(100))+'+'+IntToStr(Random(100))+'=');
end;
end;
end.
以下简单代码为一个自动随机出题的小程序,通过该例我想问几个基本概念:
1、其中代码
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
是否为一个TFrom1类的定义?
2、在该TFrom1类的定义中,哪个是类的属性、哪个是类的方法?是Button1: TButton;和
procedure Button1Click(Sender: TObject);吗?
3、“类的属性、类的方法”这句话的说法对吗?还是应该说“对象的属性、对象的方法”?
4、该TFrom1类的定义该怎样理解?我只知道类可以生成对象实例,但一到具体代码我就晕了。
请各位高手详细指教,能举例最好!
**************************************************************
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
begin
Randomize;
for I := 1 to 10 do begin
Canvas.TextOut(20,I*20,
IntToStr(Random(9)+1)+'×'+IntToStr(Random(9)+1)+'=');
Canvas.TextOut(220,I*20,
IntToStr(Random(100))+'+'+IntToStr(Random(100))+'=');
end;
end;
end.