您现在的位置: 范文先生网 >> 理工论文 >> 计算机信息技术 >> 正文

创建自己的Dephi构件

时间:2007-1-18栏目:计算机信息技术

1. 选中Component菜单项中的 New  Component选项,在 Ancestor Type 框填入Tlabel,在 Class Name框中填入 TnewLabel ,在 Palette Page框中填入  Samples,在 Unit File Name 框中填入 NewCom.pas ,然后单击按钮 Create Unit就进入到代码编辑状态。

2. 使用 Tools菜单中Image Editor来创建编辑文件NewCom.dcr,为   TnewLabel类建立位图。

3. 增加新属性EnterTextColor ,并为读写属性增加私有方法 SetEnterTextColor和私有变

量 FenterTextColor。

加入如下的代码:

Private

    FenterTextColor : Tcolor;

    SetEnterTextColor(Acolor :Tcolor);

Published

Property  EnterTextColor : Tcolor

Read  FenterTextColor  Write  SetEnterTextColor(Acolor);

Implementation

 

Procedure  TnewLabel.SetEnterTextColor(Acolor :Tcolor);

Begin

FEnterTextColor:=Acolor;

                End;

上一页  [1] [2] [3] [4] [5] [6] 下一页

下页更精彩:1 2 3 4 下一页