这个应该是组件编辑器,所有的组件编辑器都是从TComponentEditor派生出来的,它是在DesignEditors单元
中定义的(D7中),如果你要做一个这样的组件编辑器,从TComponentEditor派生一个,然后用
RegisterComponentEditor方法把你派生出来的类注册就可以了
下面是TComponentEditor的声明,部分注释如下
TComponentEditor = class(TBaseComponentEditor, IComponentEditor)
private
FComponent: TComponent; //点击右键弹出菜单的组件
FDesigner: IDesigner;
public
constructor Create(AComponent: TComponent; ADesigner: IDesigner); override;
procedure Edit; virtual; //双击组件执行的动作
procedure ExecuteVerb(Index: Integer); virtual; //不同菜单对应的操作,由Index来判断做什么样的操作
function GetComponent: TComponent;
function GetDesigner: IDesigner;
function GetVerb(Index: Integer): string; virtual; //确定显示的菜单名
function GetVerbCount: Integer; virtual; //要加入菜单的项数
function IsInInlined: Boolean;
procedure Copy; virtual;
procedure PrepareItem(Index: Integer; const AItem: IMenuItem); virtual; //准备菜单,可以为加入的菜单项加图片等
property Component: TComponent read FComponent;
property Designer: IDesigner read GetDesigner;
end;