Visual Studio C ++ 2005中表单的链接 [英] linking of forms in visual studio c++2005

查看:158
本文介绍了Visual Studio C ++ 2005中表单的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

i hav 2通过位于form1中的按钮从form1调用Form2,从而形成Form1和Form2.i.使用下面的代码form2将打开,但是form1仍然可见.


Form2().ShowDialog();
Form2().Activate();
Form1().Close();

我只希望可见form2.当form2处于活动状态时如何隐藏form1?pls help ..

-------------------------------------------------- ------------------------

@Mohammad Elsheimy如果我包含Form2().Show()而不是Form2().ShowDialog()form1打开,但是form2打开jus占一秒.我希望当我运行我的应用程序时,form2应该在我单击到一个菜单时打开

解决方案

您的应用程序将无法进入第二行:
Form2().Activate();
直到完成第一个ShowDialog()为止.

ShowDialog函数将阻止您的代码,直到窗体关闭

您应该将其更改为
Form2().Show();


i hav 2 forms Form1 n Form2.i called form2 from the form1 thru a button which is in form1. Using the following code form2 opens but form1 is still visible.


Form2().ShowDialog();
Form2().Activate();
Form1().Close();

i want only form2 to be visible .how can i hide form1 when form2 is active?pls help..

--------------------------------------------------------------------------

@Mohammad Elsheimy if i include Form2().Show() instead of Form2().ShowDialog()form1 opens but form2 opens jus for a fraction of second.i want that when i run my application form2 should open when i click to a button in form1 and form1 should be invisible.

解决方案

Your application won''t get to the 2nd line:
Form2().Activate();
until it completes the first ShowDialog().

ShowDialog function blocks your code until the form closes

you should change it to
Form2().Show();


这篇关于Visual Studio C ++ 2005中表单的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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