这样可以,已经测试:
type
TMyRichEdit=class(TRichEdit)
public
property OnConstrainedResize;
end;
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
procedure MyConstrainedResize(Sender: TObject
var MinWidth, MinHeight, MaxWidth, MaxHeight: Integer);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.MyConstrainedResize(Sender: TObject
var MinWidth, MinHeight, MaxWidth, MaxHeight: Integer);
begin
//你要的事件
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
with TMyRichEdit.Create(Self) do
begin
Parent := Self;
OnConstrainedResize:= MyConstrainedResize;
Left := 50;
Top := 50;
end;
end;