我的TMemo后代有构造函数
constructor TMyMemo.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Lines.Clear;
end;当我将TMyMemo放在窗体上时,我得到错误消息“控件'‘没有父窗口。”为什么?
发布于 2012-03-24 16:50:45
新创建的备忘录没有内容。但是,一旦组件获得名称,就会添加内容,这是由设计者自动完成的。要防止出现这种情况,请从ControlStyle中删除csSetCaption
constructor TMyMemo.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
ControlStyle := ControlStyle - [csSetCaption];
end; 发布于 2012-03-24 16:34:35
移动Lines.Clear以重写方法CreateWnd。基础窗口控件(多行编辑)在Create执行期间不存在
https://stackoverflow.com/questions/9850176
复制相似问题