需要的方法和类 :
RegisterCustomModule在单元DesignIntf中
TCustomModule在单元DesignEditors中
只要完成以下步骤就可以:
1、published你自定义的 Property 或 Event;
published
property Images: TCustomImageList read FImages write SetImages;
property ImageIndex: Integer read FImageIndex write SetImageIndex default -1;
2、利用 "Add to Repository" 将自定义的 Form 加入到 "Object Repository";
打开窗体-在窗体的空白处右击- 选择“Add to Repository..”。在Add to Repository对话框中输入信息确定。就可以在 New Items 中找到。
3、将自定义的 Form 加入到一个 Package;
新建一个 Package。将自定义的 Form加载进来。在新建一个Unit。引用上面提到的两个单元和自定义的 Form的单元。
procedure Register;
implementation
uses
DesignIntf, DesignEditors, UFrmBase;
procedure Register;
begin
RegisterCustomModule(TFrmBase, TCustomModule);
end;
4、编译Package, 在 "Install Package" 将它安装到 IDE 中