我制作了一个控件:就是 Panel里面加入一个Label,新控件从TPanel继承,
我在新控件中加入了一个TLabel对象的属性到Published,如下:
FLabel0:TLabel;
property Label0 : TLabel read FLabel0 write FLabel0;
通过该属性,用户可以在设计时更改Label的一些属性,
但是现在的问题是,设置Label属性,运行时没有效果。
我在新控件中加入了一个TLabel对象的属性到Published,如下:
FLabel0:TLabel;
property Label0 : TLabel read FLabel0 write FLabel0;
通过该属性,用户可以在设计时更改Label的一些属性,
但是现在的问题是,设置Label属性,运行时没有效果。
解决方案 »
- 谁用过D2009的 New DataSnap开发中间层服务器
- delphi7如何向socket服务器发送字符串
- 我使用的MSCOMM怎么会这样丢失数据啊 ?
- 看看这个函数为什么不行。
- 比如一个时间与现在时间相比大于10分钟这个条件,怎么写??
- c/s
- 软件项目问题,急!!!
- Treeview : 当对某一个节点右键,可是选择的节点仍然是其它节点,如何使它选择右键哪个节点?
- 我这样做软件,能有前途吗?刚到公司一个月,天天过3点回家!苦啊!
- 湖大的 DELPHI Fans Come in!!!!!!!!!!
- 怎么判断两个button是哪一个执行了.
- FastReports 3.20的报表标题乱码如何解决?
private
FLabel : TLanLabel;
...
//需要这样定义
property LabelColor:TColor read GetLabelColor write SetLabelColor;
function TNewPanel.GetLabelColor:TColor;
begin
Result := FLabel.Color;
end;procedure TNewPanel.SetLabelColor(Value:TColor);
begin
FLabel.Color := Value;
end;constructor TNewPanel.Create(AOwner: TComponent);
begin
Inherited Create(AOwner);
FLabel := TLanLabel.Create(Self);
FLabel.Parent := Self;
...destructor TNewPanel.Destroy;
begin
FLabel.Free;
Inherited;
end;
还有就是你修改的内容必须用内部变量保存在显示的时候重新加载,比如在OnPaint事件中进行加载。