近日在写一个component,基于tlabel,在其中加入tfont属性后,发现在ide中设置好tfont有关属性后,编译运行程序,原先在ide设置有tfont属性无效,
请问类似component中的类属性该如何编写
谢谢
请问类似component中的类属性该如何编写
谢谢
解决方案 »
- 三层架构 Remote data module
- DbGrid鼠标滚轮操作取值问题求助
- 关于edit控件的问题
- 请问怎么使得installshield在安装过程中重启,然后再安装?
- 请详细说明 function GetFileNames(Out iCount:Integer):TStringDynArray;Stdcall; 中的Out和stdcall的意义
- 后台处理和用户界面的问题,怎么来协调?
- 什么是无状态对象?
- 大家给点意见(想给500分的)
- 用query组件,还是老问题,如何显示当前正在操作的记录号?(之前同类问题已给分,但又碰到新问题)
- 急、急、急!!
- 为什么adoquery.text或者adoquery.add内的sql语句中带有where语句有问题?
- 一个agent的问题
当然如果你想再写一个同样的属性.
我想是不是名字别一样,换成tfonta,tfont1什么的。
在类定义published中写:property Font;即可!
private
fPrint:boolean;
fText:tstrings;
fFont:tfont;
fAlignment:talignment;
ftop:integer;
fRowspace:integer;
fEveryPage:boolean;
procedure SetText(value:tstrings);
procedure SetFont(value:tfont);
published
property Print:boolean read fprint write fprint ;
property Text:tstrings read fText write settext;
property Font: TFont read fFont write SetFont;
property Top:integer read ftop write ftop;
property Alignment:talignment read fAlignment write fAlignment;
property Rowspace:integer read fRowspace write fRowspace;
property EveryPage:boolean read fEveryPage write fEveryPage;
end;
implementationprocedure ttitle.SetFont(Value: TFont);
begin
Ffont.Assign(Value);
end;