delphi - 在运行时创建 Tframe :

标签 delphi runtime tframe

是否可以创建运行时框架并添加现有面板,例如将面板的父级设置为框架?添加后,复制框架并使用它?

喜欢:

f:= Tframe. create(..)
...

panel3.parent = f; //where panel3 has many controls.

然后复制 f?有可能吗?如何?或任何其他建议?

最佳答案

我认为你不会通过重复来解决这个问题。您需要的是这样的函数:

function CreateFrameAndHostPanel(Owner: TComponent; Parent: TWinControl; Panel: TPanel): TFrame;
begin
  Result := TFrame.Create(Owner);
  Try
    Result.Parent := Parent;
    Panel.Parent := Result;
  Except
    FreeAndNil(Result);
    raise;  
  End;
end;

关于delphi - 在运行时创建 Tframe :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4398925/

相关文章:

delphi - 在哪里释放动态分配的 TFrame 组件对象?

c++ - 在运行时动态创建多个框架时出错(C++,FMX,IDE:C++ Builder)

delphi - Delphi中如何删除文本文件中的特定行

Delphi firemonkey tabstop 选项卡控件中的问题

java - 使用特殊编码将 Java String 写入文件

c# - 使用 .NET 3.5 和 C# 从文件在运行时编译 IL 代码

c - 在 C 中执行时取消定义宏

delphi - DCC 错误 : E2003 Undeclared identifier: 'Result'

python - 使用 sframe.apply() 导致运行时错误