取自Delphi的联机帮助:
Use TComponentEditor or one of its descendants as a base class when defining
a design-time editor for working with a new component class. Although you can
create component editors that descend directly from TBaseComponentEditor, it is
convenient to use TComponentEditor, because this classs supplies a default
implementation of the IComonentEditor interface.
Create a new component editor class for a component class to add verbs to
its context menu, change its default double-click behavior, or allow the
component to use a new clipboard format.
Once the component editor is defined, it can be registered to work with a
particular component class. A registered component editor is created for each
component of that class when it is selected in the form designer. When the
component is double-clicked, the Edit method of the component editor is called.
When the user right-clicks the component, the GetVerbCount and GetVerb methods
of the editor are called to build context menu. To create the association
between a component editor and a component class, call RegisterComponentEditor.
Delphi provides a descendant of TComponentEditor (TDefaultEditor) which all
components use if they have no registered association with a component editor.
意即你从TBaseComponentEditor或TComponentEditor继承下来,为一个构件写一个构
件编辑器,这样当在设计时双击你的构件时,它获得你现在赋予它的能力,即会执行Edit之
中的方法。建议从后者继承,这样的话,因为它已经有一个IComponentEditor的默认实现了。
在写继承TComponentEditor以,访问Component属性,就可以得到当前被编辑的构件。