关闭1表格并打开另一个完全控制[C ++] [英] Close 1 Form and open another with full control [C++]

查看:72
本文介绍了关闭1表格并打开另一个完全控制[C ++]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,所以即时通过Windows Forms学习C ++,我有一个登录表单(FORM1)&和大型机表格(FROM2)。

Okay So im learning C++ with Windows Forms and I have a Login form(FORM1) & and mainframe form(FROM2).

我试图这样做当我点击一个按钮它将关闭FORM1并打开FORM2,给FORM2完全控制以结束应用程序。

I am trying to make it so when i click a button it will close FORM1 and open FORM2, giving FORM2 full control for ending the application.

我现在设置的方式是它打开FORM2并且只隐藏(this-> Visible = false)FORM1。但是我想给form2完全控制能够结束应用程序。

The way I have it setup now is that it opens FORM2 and only hides(this->Visible = false) FORM1. But I want to give form2 full control of been able to end the application.

推荐答案

问候Scott。

Greetings Scott.

我建议稍微重新安排你的程序结构。

I recommend rearranging your program structure a bit.

我会让Form2成为程序启动时运行的那个,它应该做的第一件事是启动Form1(登录形成)。 Form1应该传回一个布尔值来说明登录是成功还是失败。如果失败,那么Form2应该关闭。如果成功,
Form2应该继续运行。

I would make Form2 the one that runs at program startup, and the first thing it should do is fire up Form1 (the login form). Form1 should pass back a boolean to say whether the login succeeded or failed. If it failed, Form2 should then shut down. If it succeeded, Form2 should just keep running.


这篇关于关闭1表格并打开另一个完全控制[C ++]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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