gpt4 book ai didi

delphi - 具有空行的 TMemo 后代

转载 作者:行者123 更新时间:2023-12-03 15:37:47 28 4
gpt4 key购买 nike

我的 TMemo 后代有构造函数

constructor TMyMemo.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Lines.Clear;
end;

当我将 TMyMemo 放在表单上时,出现错误“Control ''没有父窗口。”。为什么?

最佳答案

新创建的备忘录没有内容。但是,一旦组件获得名称,内容就会添加,这是由设计者自动完成的。为了防止这种情况,请从 ControlStyle 中删除 csSetCaption:

constructor TMyMemo.Create(AOwner: TComponent); 
begin
inherited Create(AOwner);
ControlStyle := ControlStyle - [csSetCaption];
end;

关于delphi - 具有空行的 TMemo 后代,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9850176/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com