在Windows应用程序中选择子窗体时如何隐藏父窗体 [英] how to hide the parent form when child form is selected in windows application

查看:73
本文介绍了在Windows应用程序中选择子窗体时如何隐藏父窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.....我在C#Windows应用程序中有一个要求.我有父窗体和子窗体.....我想要的是,当我单击子窗体时,任务栏上将显示两个窗口,即子屏幕和主屏幕.子屏幕和主屏幕应该相互链接,并且在任务栏中应该只显示一个窗口.我需要一些帮助来实现此要求.请帮我...
预先感谢

hello all.....i have a requirement in C# windows application. i have parent form and child forms.....what i want is, when i click on child form Two windows are shown in the Taskbar i.e the child screen and the main screen. The child screen and the main screen should be interlinked and only one window should be shown in the Taskbar.I want some help to implement this requirement. pls help me...
thanks in advance

推荐答案

这不是一个好主意,但是...您要做的就是更改表单的ShowInTaskbar属性.麻烦的是,当您更改它们时,可能会导致屏幕闪烁.我可能会做的事情(默认情况下对我所有的子窗体都做)将仅将主窗体设置为ShowInTaskbar = true,其他所有窗体都设置为false.这样,您的应用程序只会在任务栏上显示一个图标.麻烦的是,如果您实际上是在为主窗体调用隐藏",则任务栏图标也会消失.
It''s not a brilliant idea, but...all you have to do is change the ShowInTaskbar property of the forms. The hassle is that it will probably cause a screen flicker when you change them. What I would probably do (and do by default for all my sub forms) is set only the main form to ShowInTaskbar = true, all the others get false. That way you app only ever shows a single icon on the taskbar. The hassle is that if you are actually calling Hide for the main form, the taskbar icon will disappear as well.


private void btnShowChild_clicked(object sender, eventArgs e)
        {
            
                ChildForm obj = new ChildForm();
                obj.Show(); // will show the child form window
                this.Hide(); // hide parent window
            
        }


这篇关于在Windows应用程序中选择子窗体时如何隐藏父窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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