很简单,继承一个TMemo就是了,你自己为什么不试一试呢?
unit ZWMemo;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TOnMemo = procedure(msg : string) of object;
TZWMemo = class(TMemo)
private
{ Private declarations }
FOnMemo: TOnMemo;
protected
{ Protected declarations }
public
{ Public declarations }
procedure Change;override;
published
{ Published declarations }
property OnMemo : TOnMemo read FOnMemo write FOnMemo;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TZWMemo]);
end;
procedure TZWMemo.Change;
begin
if assigned(OnMemo) then OnMemo(text);
if assigned(OnChange) then OnChange(self);
end;
end.