创建自己的Dephi构件
1. 选中Component菜单项中的 New Component选项,在 Ancestor Type 框填入Tlabel,在 Class Name框中填入 TnewLabel ,在 Palette Page框中填入 Samples,在 Unit File Name 框中填入 NewCom.pas ,然后单击按钮 Create Unit就进入到代码编辑状态。
本文链接地址:http://www.oyaya.net/fanwen/view/142642.html
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;
《创建自己的Dephi构件(第3页)》