本文介绍了TMemo后代带有空行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的TMemo后代具有构造函数
My TMemo descendant has constructor
constructor TMyMemo.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Lines.Clear;
end;
当我将TMyMemo放在表格上时,出现错误控件’没有父窗口。。为什么?
When I put TMyMemo on the form I get error "Control '' has no parent window.". Why?
推荐答案
新创建的备忘录没有内容。但是,一旦组件获得名称,就会添加内容,这是设计者自动完成的。为了防止这种情况,请从 ControlStyle
中删除 csSetCaption
:
A newly created memo has no content. But content is added as soon as the component acquires a name, which is done automatically by the designer. To prevent this, remove csSetCaption
from ControlStyle
:
constructor TMyMemo.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
ControlStyle := ControlStyle - [csSetCaption];
end;
这篇关于TMemo后代带有空行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!