如何将 MainForm 设置为在程序启动时隐藏?
我正在使用 Borland c++ 构建器。我有一个应用程序,我希望隐藏主窗体,直到按下不同窗体上的按钮为止。我已将主窗体上的可见值设置为 false,但当我运行程序时它仍然显示。有人知道该怎么办吗?
I am using the Borland c++ builder. I have an application where I want the main form to be hidden until a button is pressed on a different form. i have set the Visible value on the mainform to false, but it still shows up when i run the program. anyone know what to do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
C++Builder 附带有一个演示可以执行此操作,可以在 demos\cpp\apps\twoforms 中找到
“First”是带有显示“Second”按钮的表单
按钮的 OnClick 事件处理程序使用以下命令创建新表单new,然后调用 ShowModal()
如果它不是模态形式,则可以只使用 Show()。
There is a demo that comes with C++Builder that does this It can be found in demos\cpp\apps\twoforms
"First" is the form with the button that shows "Second"
The button's OnClick event handler creates the new form with new, then calls ShowModal()
You can use just Show() if it isn't meant to be a modal form.
查看 TApplication ShowMainForm 属性。
以下是基于在线帮助中的说明的示例。
将主窗体 Visible 属性设置为 false。
在菜单上选择项目 ->查看源代码以显示主项目文件。
在调用Application->CreateForm之后、调用Application->Run之前添加以下代码。
Application->ShowMainForm = false;
你应该得到这样的结果。
Have a look at the TApplication ShowMainForm property.
Here is an example based on the instructions in online help.
Set the main form Visible property to false.
On the menu select Project -> View Source to display the main project file.
Add the following code after the call to Application->CreateForm and before the call to Application->Run.
Application->ShowMainForm = false;
You should end up with something like this.