在启动时隐藏表单:为什么不这样做?隐藏()隐藏我的表单? [英] Hiding forms on startup: why doesn't this.Hide() hide my form?

查看:103
本文介绍了在启动时隐藏表单:为什么不这样做?隐藏()隐藏我的表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在启动时隐藏应用程序的主窗口,所以我把它放在构造函数中:

I wanted to hide the main window of my app on startup, so I put this in the constructor:

this.Hide();

虽然这并不隐藏我的表单。看来我只能得到按钮来隐藏表单。我在这里做错了什么?

This doesn't hide my form though. It seems like I can only get buttons to hide the form. Am I doing something wrong here?

推荐答案

你可以使用这行代码。它不会隐藏它,但它会被最小化:

you can use this line of code. It wont hide it, but it will be minimized:

this.WindowState = FormWindowState.Minimized;

另外,如果您不希望它显示在任务栏上,则可以添加此line:

in addition, if you don't want it showing on the task bar either, you can add this line:

this.ShowInTaskbar = false;

但是,如果您不希望它首先可见,那么为什么要创建表单? ?

But why do you create the form if you don't want it to be visible in the first place?

这篇关于在启动时隐藏表单:为什么不这样做?隐藏()隐藏我的表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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