这个问题很容易解决,我可以给做一个例子,我刚刚研究成功的,呵呵,共享吧,
这个组件将有一个属性StringEX电击,弹出一个窗口,可以做任何处理,
不仅仅是一个About对话框
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,DesignIntf,DesignEditors, StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
Button2: TButton;
private
{ Private declarations }
public
{ Public declarations }
end;
TComponent1 = class(TComponent)
private
FStringEx: string;
procedure SetStringEx(const Value: string);
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
property StringEx: string read FStringEx write SetStringEx;
end;
TTestProperty = class(TPropertyEditor)
FDataString: string;
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
end;
function Execute: string;
procedure Register;
implementation
{$R *.dfm}
procedure Register;
begin
RegisterPropertyEditor(TypeInfo(string), TComponent1,'StringEx',TTestProperty);
RegisterComponents('Samples', [TComponent1]);
end;
{ TPDFDataStringProperty }
procedure TTestProperty.Edit;
begin
inherited;
Execute;
end;
function TTestProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paDialog];
end;
function TTestProperty.GetValue: string;
begin
end;
function Execute: string;
begin
with TForm1.Create(Application) do
begin
Position := poDesktopCenter;
ShowModal;
end;
end;
{ TComponent1 }
procedure TComponent1.SetStringEx(const Value: string);
begin
FStringEx := Value;
end;
end.