delphi在设计时创建组件吗

2025-05-14 00:16:12
推荐回答(4个)
回答1:

创建。
在设计期,当你在窗体上置入新的控件时,如果此控件Create事件中创建与该控件所需的组件,会随该控件一并创建,但某些干预设计期的事件将不被执行,由TComponentState决定,如:
if csDesigning in ComponentState then ...
if csLoading in ComponentState then...
参考:
TComponentState = set of (csLoading, csReading, csWriting, csDestroying,
csDesigning, csAncestor, csUpdating, csFixups, csFreeNotification,
csInline, csDesignInstance);
TComponentStyle = set of (csInheritable, csCheckPropAvail, csSubComponent,
csTransient);

回答2:

设计时创建组件,运行时也可以创建组件,很方便。

回答3:

设计时创建组件,就是拖拉就行。

你是不是想问,在运行时可以创建组件吗?
这个也可以,组件就是一个类,可以在运行时创建。

回答4:

var i:integer; begin for i:=1 to 10 do begin with TEdit.Create(Self) do begin Name:='edt'+IntToStr(i); Parent:=self; Width:=75; ,TjVxBk