如何将 MainForm 设置为在程序启动时隐藏?

发布于 2024-09-13 13:09:21 字数 107 浏览 3 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

北城半夏 2024-09-20 13:09:40

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.

转身泪倾城 2024-09-20 13:09:35

查看 TApplication ShowMainForm 属性。

以下是基于在线帮助中的说明的示例。

  1. 将主窗体 Visible 属性设置为 false。

  2. 在菜单上选择项目 ->查看源代码以显示主项目文件。

  3. 在调用Application->CreateForm之后、调用Application->Run之前添加以下代码。

    Application->ShowMainForm = false;

你应该得到这样的结果。

try
{
  Application->Initialize();
  Application->MainFormOnTaskBar = true;
  Application->CreateForm(__classid(TMainForm), &MainForm);
  // extra code to hide main form
  Application->ShowMainForm = false;
  Application->Run();
}

Have a look at the TApplication ShowMainForm property.

Here is an example based on the instructions in online help.

  1. Set the main form Visible property to false.

  2. On the menu select Project -> View Source to display the main project file.

  3. 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.

try
{
  Application->Initialize();
  Application->MainFormOnTaskBar = true;
  Application->CreateForm(__classid(TMainForm), &MainForm);
  // extra code to hide main form
  Application->ShowMainForm = false;
  Application->Run();
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文