N
nhuangjr
Unregistered / Unconfirmed
GUEST, unregistred user!
我想做一个组件。该组件继承BusinessSkin的 TbsSkinPanel 。我想在组件里添加一个TbsSkinTextLabel 属性,用来在SkinPanel 的caption 下面显示一些文字信息。我的代码如下:
unit FlashCaptionPanel;
interface
uses
SysUtils, Classes, Controls, ExtCtrls,Graphics,Types, bsSkinCtrls;
type
TTestPanel = class(TbsSkinPanel)
private
{ Private declarations }
protected
{ Protected declarations }
FPanelText: TbsSkinTextLabel;
procedure SetPanelText(Value:TbsSkinTextLabel);
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure AddPanelText;
published
{ Published declarations }
property PanelText : TbsSkinTextLabel read FPanelText write SetPanelText ;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('MyFlashPanel VCL', [TTestPanel]);
end;
constructor TTestPanel.Create;
begin
inherited Create(AOwner);
AddPanelText;
end;
destructor TTestPanel.Destroy;
begin
if FPanelText<>nil then FPanelText.Free;
inherited ;
end;
procedure TTestPanel.AddPanelText;
begin
FPanelText:=TbsSkinTextLabel.Create(self);
FPanelText.Lines.Add('');
//FPanelText.SetBounds(10,10,50,50);
FPanelText.Align:=alClient;
FPanelText.Alignment:= taCenter;
FPanelText.Parent :=self;
FPanelText.Visible :=true;
end;
procedure TTestPanel.SetPanelText ;
begin
FPanelText.Assign(Value);
end;
end.
该组件可以正常注册,但PanelText.Lines 的东西只能在设计期间能够在面板上正常显示,在运行时,给PanelText.Lines.add('东西') 的话没有显示请高手指教该怎么改啊!!!
unit FlashCaptionPanel;
interface
uses
SysUtils, Classes, Controls, ExtCtrls,Graphics,Types, bsSkinCtrls;
type
TTestPanel = class(TbsSkinPanel)
private
{ Private declarations }
protected
{ Protected declarations }
FPanelText: TbsSkinTextLabel;
procedure SetPanelText(Value:TbsSkinTextLabel);
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure AddPanelText;
published
{ Published declarations }
property PanelText : TbsSkinTextLabel read FPanelText write SetPanelText ;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('MyFlashPanel VCL', [TTestPanel]);
end;
constructor TTestPanel.Create;
begin
inherited Create(AOwner);
AddPanelText;
end;
destructor TTestPanel.Destroy;
begin
if FPanelText<>nil then FPanelText.Free;
inherited ;
end;
procedure TTestPanel.AddPanelText;
begin
FPanelText:=TbsSkinTextLabel.Create(self);
FPanelText.Lines.Add('');
//FPanelText.SetBounds(10,10,50,50);
FPanelText.Align:=alClient;
FPanelText.Alignment:= taCenter;
FPanelText.Parent :=self;
FPanelText.Visible :=true;
end;
procedure TTestPanel.SetPanelText ;
begin
FPanelText.Assign(Value);
end;
end.
该组件可以正常注册,但PanelText.Lines 的东西只能在设计期间能够在面板上正常显示,在运行时,给PanelText.Lines.add('东西') 的话没有显示请高手指教该怎么改啊!!!