你需要的是ComponentEditor还是PropertyEditor?其实{$Delphi}\Source下有一堆PropertyEditor的源码。
解决方案 »
- 在3层结构中query中同样是添加操作,为什么备注字段不可以append追加?
- 关于DBNavigator组件的问题
- 请问各位那里有完整的 DELPHI 7 下载? 企业版 人版都可以
- 关于文件操作的问题!!!!!!!!!!!!!???????????????????????????????
- 在DEPHI中怎样使用QuickReport!
- 分布的问题,急救!急救!
- 求助Delphi怎样向excel里写数据?
- 关于delphi与sybase
- 请教关于activeX和mdb的问题,紧急,请帮忙
- 那里有第三方控件下载
- 怎么读取TextFile中的一段文字?
- 如何把TQRPAGE 的TQRPAPERSIZE取回来,写回去 : forgot2000(忘记2000年)
Copyright ?1999 by Delphi 5 Developer's Guide - Xavier Pacheco and Steve Teixeira
}
unit CompEdit;interfaceuses
SysUtils, Windows, Messages, Classes, Graphics, Controls, Forms, Dialogs,
DsgnIntf;type
TComponentEditorSample = class(TComponent)
protected
procedure SayHello; virtual;
procedure SayGoodbye; virtual;
end; TSampleEditor = class(TComponentEditor)
public
procedure ExecuteVerb(Index: Integer); override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
end;implementation{ TComponentEditorSample }procedure TComponentEditorSample.SayHello;
begin
MessageDlg('Hello, there!', mtInformation, [mbOk], 0);
end;procedure TComponentEditorSample.SayGoodbye;
begin
MessageDlg('See ya!', mtInformation, [mbOk], 0);
end;{ TSampleEditor }const
vHello = 'Hello';
vGoodbye = 'Goodbye';procedure TSampleEditor.ExecuteVerb(Index: Integer);
begin
case Index of
0: TComponentEditorSample(Component).SayHello; // call function
1: TComponentEditorSample(Component).SayGoodbye; // call function
end;
end;function TSampleEditor.GetVerb(Index: Integer): string;
begin
case Index of
0: Result := vHello; // return hello string
1: Result := vGoodbye; // return goodbye string
end;
end;function TSampleEditor.GetVerbCount: Integer;
begin
Result := 2; // two possible verbs
end;end.
TYourForm = class(TForm)
...
public
YourComponent: TYourComponent;
end;procedure ShowYourForm(AYourComp: TYourComponent);
begin
with TYourForm.Create(nil) do
try
YourComponent := AYourComp;
ShowModal;
finally
Free
end;
end;
end;