FireMonkey框架可以动态创建吗? [英] Can FireMonkey frames be created dynamically?

查看:64
本文介绍了FireMonkey框架可以动态创建吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

FireMonkey可以选择使用框架(不是TFrame,这是一种特殊的视觉组件),这些框架基本上是可以重用的视觉组件的集合.

FireMonkey has the option of using frames (not TFrame, which is a specific kind of visual component), which basically are collections of visual components which can be reused.

http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Working_with_Frames

但是,文档中没有关于动态创建框架实例的任何内容,而不是在设计时将它们放置在TForm上.有没有一种方法可以动态创建框架实例?尝试执行此操作时,尝试访问问题属性的框架时会出错.

However, there is nothing in the documentation about creating instances of frames dynamically, instead of placing them at design time on a TForm. Is there a way to create instances of a frame dynamically? When I try to do this, I get errors when attempting to access the frame in question's properties.

推荐答案

TFrame是一个简单的TControl,您可以像平常的Tcontrol组件一样创建和使用它.如果将TFrame更改为TControl,则不会发生任何变化,因为它是相同的.

TFrame is a simple TControl, you can create and use it as usual Tcontrol component. If you would change TFrame to TControl - nothing change because it is same.

var
  MyFrame: TFrame;

begin
  MyFrame := TFrame.Create(Self); 
  MyFrame.Parent := Self; 

自我是TForm或任何其他TControl

Self is TForm or any other TControl

这篇关于FireMonkey框架可以动态创建吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆