在Delphi下怎么制作一个复合控件。比如在一个TPanel上放一个TLabel。做为一个控件?
解决方案 »
- delphi 写 ActiveX 的疑问,请了解的朋友指教一下
- 一個權限管理的問題
- 在程序中用到TTS,而且有用到中文TTS,请问怎样把它打包成安装程序?高分求救,在线等
- 请问我的客户端为什么连接不上 求各位大哥大姐 帮忙
- 运行时动态创建的菜单,怎么判断当前点击的是菜单项里的哪一个item?
- 简单问题给高分
- 谁有这样的代码?我的只能打横线,但怎么来大竖线?UP有分
- ccclock,定时提示,自动关闭广告页,绿色软件,免费,368K
- 讨论:{面向对象开发数据库<->delphi的数据感应控件绑定}^{原生ADO<->delphi封装好的ADO控件}
- delphi如何使用bcb生成的dll,有解决问题者,200分相送
- 操作系统不同导致结果不同
- 在Delphi下怎么制作一个复合控件。比如在一个TPanel上放一个TLabel。做为一个控件?
SysUtils, Classes, Controls, ExtCtrls, StdCtrls;type
TCustomPanel1 = class(TCustomPanel)
private
{ Private declarations }
MyLabel: TLabel;
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
{ Published declarations }
end;procedure Register;implementationprocedure Register;
begin
RegisterComponents('Samples', [TCustomPanel1]);
end;{ TCustomPanel1 }constructor TCustomPanel1.Create(AOwner: TComponent);
begin
inherited;
MyLabel:=TLabel.Create(Self);
with MyLabel do begin
Parent:=Self;
Visible:=True;
Top:=10;
..
end;
end;destructor TCustomPanel1.Destroy;
begin
FreeAndNil(MyLabel);
inherited;
end;end.
unit paneld;interfaceuses
Windows, Messages, SysUtils, Classes, Controls, ExtCtrls,QStdCtrls;type
tpaneld = class(tpanel)
private
{ Private declarations }
Flbl1:TLabel;
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner:TComponent);override;
destructor Destroy;override;
published
{ Published declarations }
end;procedure Register;implementationprocedure Register;
begin
RegisterComponents('Samples', [tpaneld]);
end;constructor tpaneld.Create(AOwner:TComponent);
begin
inherited Create(AOwner);
Flbl1 := TLabel.Create(AOwner);
Flbl1.Caption := 'adf';
end;destructor tpaneld.Destroy;
begin
Flbl1.Free;
inherited Destroy;
end;