如何将表单作为参数传递给过程并操作其属性?
假设我想在我制作的单元中创建一个过程,该过程按名称显示和隐藏表单(作为参数传递)。
我怎样才能做到这一点以及语法是什么?
谢谢。
编辑
我正在寻找类似的东西:Popup(FormMy, 'Show');从我的单位内部。
Let's say I want to create a procedure in a unit I made that shows and hide forms by name (passed as parameter).
How could I do that and what's the syntax?
Thanks.
EDIT
I'm looking for something like: Popup(FormMy, 'Show'); from inside my Unit.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以编写这样的过程
,并通过
ShowMyForm(MyForm, True);
调用您的表单,并确保您的单元使用 Forms
正如 David 所说,您可以做到这一点
You can write a procedure like this
and call your form by
ShowMyForm(MyForm, True);
and be sure that your unituses Forms
As David said you can make it
假设表单是使用父表单作为所有者 [.Create(Self)] 创建的,这应该有效:
Assuming that the forms were created with the parent form as the owner [.Create(Self)], this should work:
您可以循环全局 Screen 对象的 CustomForms 属性(有 CustomFormCount 个)。这只是枚举了应用程序中的所有 VCL 表单,这可能是您想要的。
如果你正在寻找代码,它会是这样的:
You can loop around the CustomForms property (there are CustomFormCount of them) of the global Screen object. This simply enumerates all the VCL forms in the app which may be what you want.
If you are looking for code it would be something like this: