下面几行代码就可以出一个很简陋的编辑框的控件,当然其他属性还得自己弄.这个是继承TWinControl下来的.
procedure TMyEdit.CreateParams(var Params:TCreateParams);
begin
inherited CreateParams(Params);
CreateSubClass(Params,'Edit');
end;
Constructor TMyEdit.Create(AOwner: TComponent);
const
EditStyle = [csClickEvents, csSetCaption, csDoubleClicks, csFixedHeight];
begin
inherited Create(AOwner);
ControlStyle := EditStyle + [csFramed];
if (AOwner is TWinControl) then
parent:=TWinControl(AOwner);
Width := 100;
Height := 25;
end;
Destructor TMyEdit.Destroy();
begin
inherited ;
end;