我正常地在SO周围散步并碰到一些框架讨论.
我主要是Delphi的爱好者,而不是专业人士,所以我必须学习如何以我自己的方式使用TFrame:
经过一番个人商议,这是我的做法.
还有哪些方法可以使用框架?
Ste*_*eve 14
这是一种方式,它没有任何问题.另一种方法是,在视觉上做到这一点.所以你基本上可以将框架添加到表单中.这样做你:
您的方法唯一的问题是您不能将同一帧的多个实例添加到给定的表单:
Frame1 := TMyFrame.Create(Self);
Frame1.Parent := Self;
// ...
Frame2 := TMyFrame.Create(Self); // bombs out with "a component with the name MyFrame already exists"
Run Code Online (Sandbox Code Playgroud)
他的解决方法是为每个实例分配一个不同的名称:
Frame1 := TMyFrame.Create(Self)
Frame1.Parent := Self;
Frame1.Name := "FirstFrame";
// ...
Frame2 := TMyFrame.Create(Self); // works now, there is no name conflict
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11645 次 |
| 最近记录: |