近日在写一个component,基于tlabel,在其中加入tfont属性后,发现在ide中设置好tfont有关属性后,编译运行程序,原先在ide设置有tfont属性无效,
请问类似component中的类属性该如何编写
谢谢

解决方案 »

  1.   

    tlabel里已经有这个属性.
    当然如果你想再写一个同样的属性.
    我想是不是名字别一样,换成tfonta,tfont1什么的。
      

  2.   

    该component有两个tfont属性,一个是fontForce,一个是fontBack
      

  3.   

    tlabel已经有font属性,所以你只要继承下来就行了啊!
    在类定义published中写:property Font;即可!
      

  4.   

    我的意思是要两个另外的tfont属性,自己用的,不要继承原来的
      

  5.   

    TTitle = class(tpersistent)
      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;
      

  6.   

    谢谢啦,不过如果tfont换成timage呢?就有我说的问题