请各位同道举一个继承的例子我看看.一定送分
比如TLable这个构件是继承什么来的
还有TWinConntrol这个东西是什么
问题点数:33、回复次数:3Top
1 楼halfdream(哈欠)回复于 2001-11-25 23:56:10 得分 33
你每写一个简单的DELPHI程序都用到继承的。还用得着专门举例吗?
你的TForm1 就是继承自TForm.
至于这些控件, 在帮助中谁怎么继承来的列得一清二楚,不用多话。
TWinControl 它包含了个窗口句柄。。从这个控件继承下去的东西可以有窗口提供的功能,
以及消息循环等。
Top
2 楼w8u(晌马)回复于 2001-11-26 08:36:35 得分 0
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;
TMyLabel=class(TLabel)
public
procedure SetMyCaption();
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
//procedure TMyLabel.
procedure TForm1.Button1Click(Sender: TObject);
var
MyLabel:TMyLabel;
begin
MyLabel := tMyLabel.Create(self);
try
MyLabel.SetMyCaption();
MyLabel.parent:=self;
MyLabel.Left:=200;
MyLabel.Top:=100;
finally
end;
end;
{ TMyLabel }
procedure TMyLabel.SetMyCaption;
begin
Caption:='这是我预先设好的。';
end;
end.Top
3 楼V_Lucky(最优解)回复于 2001-11-26 09:57:40 得分 0
TForm1 = class(TForm)
TForm1 就是从TForm 继承下来的
这就是一个很好的例子
Top




