T
tomol
Unregistered / Unconfirmed
GUEST, unregistred user!
我最近在做一个走马灯的控件,就是让文本不停地滚动,现在很多About上都是这样的
具体代码如下,但我在设计期设好的FLines在设计期可以正常显示,但一运行就被
Create里的初试字符串替代,请高手指点,多谢多谢!!!
另:请高手讲讲如何做属性编辑器,多谢多谢!!
解释:我定义的控件是从TScrollTitle = class(TCustomControl)继承的
其中有一个Panel和一个Label控件,label控件在Panel里滚动,又定义了
FLines来保存用户输入的字符串
private
{ Private declarations }
FLines: TStrings;
FLabelTitle: TLabel;
procedure SetLines(const Value: TStrings);
function GetLines: TStrings;
published
{ Published declarations }
property Lines: TStrings read GetLines write SetLines;
constructor TScrollTitle.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
。。。。。
FLines := TStringList.Create;
FLines.Add('This is a Scroll Title Component!');
FLines.Add('Welcome to Controls World');
FLabelTitle := TLabel.Create(Self);
FLabelTitle.Parent := FPanelTitle;
FLabelTitle.Caption := FLines.Text;
FLabelTitle.AutoSize := true;
FLabelTitle.Left := 10;
FLabelTitle.Top := FPanelTitle.Top + FPanelTitle.Height;
FLabelTitle.Color := FColor;
。。。。。。
end;
function TScrollTitle.GetLines: TStrings;
begin
Result := FLines;
FLabelTitle.Caption := FLines.Text;
end;
procedure TScrollTitle.SetLines(const Value: TStrings);
var
iCount: integer;
begin
iCount:=0;
FLines.Assign(Value);
FLabelTitle.Caption := '';
FLabelTitle.Caption := FLines.Strings[iCount];
for iCount:=1 to FLines.Count-1 do
FLabelTitle.Caption := FLabelTitle.Caption + #13 + FLines.Strings[iCount];
end;
急,在线等
具体代码如下,但我在设计期设好的FLines在设计期可以正常显示,但一运行就被
Create里的初试字符串替代,请高手指点,多谢多谢!!!
另:请高手讲讲如何做属性编辑器,多谢多谢!!
解释:我定义的控件是从TScrollTitle = class(TCustomControl)继承的
其中有一个Panel和一个Label控件,label控件在Panel里滚动,又定义了
FLines来保存用户输入的字符串
private
{ Private declarations }
FLines: TStrings;
FLabelTitle: TLabel;
procedure SetLines(const Value: TStrings);
function GetLines: TStrings;
published
{ Published declarations }
property Lines: TStrings read GetLines write SetLines;
constructor TScrollTitle.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
。。。。。
FLines := TStringList.Create;
FLines.Add('This is a Scroll Title Component!');
FLines.Add('Welcome to Controls World');
FLabelTitle := TLabel.Create(Self);
FLabelTitle.Parent := FPanelTitle;
FLabelTitle.Caption := FLines.Text;
FLabelTitle.AutoSize := true;
FLabelTitle.Left := 10;
FLabelTitle.Top := FPanelTitle.Top + FPanelTitle.Height;
FLabelTitle.Color := FColor;
。。。。。。
end;
function TScrollTitle.GetLines: TStrings;
begin
Result := FLines;
FLabelTitle.Caption := FLines.Text;
end;
procedure TScrollTitle.SetLines(const Value: TStrings);
var
iCount: integer;
begin
iCount:=0;
FLines.Assign(Value);
FLabelTitle.Caption := '';
FLabelTitle.Caption := FLines.Strings[iCount];
for iCount:=1 to FLines.Count-1 do
FLabelTitle.Caption := FLabelTitle.Caption + #13 + FLines.Strings[iCount];
end;
急,在线等